@adactive/adsum-screensaver-asia
Advanced tools
Comparing version 2.5.7 to 2.5.8
1.0.0 - Create a ScreenSaver which have 2 redux to close | ||
screensaver and to reset screensaver timer | ||
screensaver and to reset screensaver timer | ||
2.5.5 - add custom function when screensaver open and close | ||
2.5.6 - add a prop to force open screensaver (and run custom function open screensaver too) | ||
2.5.7 - add a prop to force close screensaver (and run custom function close screensaver too) |
{ | ||
"name": "@adactive/adsum-screensaver-asia", | ||
"version": "2.5.7", | ||
"version": "2.5.8", | ||
"description": "Adsum Screensaver Component", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,3 +24,4 @@ # Carousel component | ||
There is 2 redux prop actions that this component have: | ||
There is 5 redux prop actions that this component have. Top 2 of that are mandatory to be applied tp make apps works well. | ||
- Action to close Screen Saver | ||
@@ -30,2 +31,8 @@ **(ScreenSaverActions.screenSaverClose)** | ||
**(ScreenSaverActions.appClick)** | ||
- Additional Custom Function you want when Screen Saver Close and Open | ||
**(ScreenSaverActions.customCloseFunction)** and **(ScreenSaverActions.customOpenFunction)** | ||
- Action to force open Screen Saver usually useful when using screensaver as homepage (can run customopenfunction too) | ||
**(ScreenSaverActions.forceOpenScreenSaver)** | ||
- Action to force close Screen Saver (can run customclosefunction too) | ||
**(ScreenSaverActions.forceCloseScreenSaver)** | ||
@@ -47,2 +54,3 @@ Put these to actions on the **mapDispatchToProps** | ||
4. Attach ScreenSaver Component | ||
**Usually function screensaverclose is placed here** | ||
for example: | ||
@@ -83,2 +91,10 @@ ```javascript | ||
**children** - html elements or components inside <ScreenSaver> tag that will be called after screensaver's timer time out | ||
**customCloseFunction** - a serial custom function to attach when Screen Saver close | ||
**customOpenFunction** - a serial custom function to attach when Screen Saver open | ||
**forceOpenScreenSaver** - to activate force open screensaver or not (boolean) | ||
**forceCloseScreenSaver** - to activate force close screensaver or not (boolean) | ||
@@ -90,2 +106,4 @@ ```javascript | ||
children: Element<any> | ||
customCloseFunction: *, | ||
customOpenFunction: *, | ||
|}; | ||
@@ -97,2 +115,9 @@ | ||
}; | ||
type MappedDispatchPropsType = {| | ||
appClick: (value: ?boolean) => void, | ||
screenSaverClose: (value: ?boolean) => void, | ||
forceOpenScreenSaver: (value: ?boolean) => void, | ||
forceCloseScreenSaver: (value: ?boolean) => void, | ||
|}; | ||
``` | ||
@@ -99,0 +124,0 @@ |
@@ -23,2 +23,3 @@ // @flow | ||
forceOpenScreenSaver: (value: ?boolean) => void, | ||
forceCloseScreenSaver: (value: ?boolean) => void, | ||
|}; | ||
@@ -64,2 +65,3 @@ | ||
customOpenFunction, | ||
forceCloseScreenSaver, | ||
} = this.props; | ||
@@ -95,2 +97,11 @@ | ||
} | ||
if (screenSaverState.forceClose) { | ||
if (customCloseFunction) { customCloseFunction(); } | ||
if (this.timer) { clearTimeout(this.timer); } | ||
// eslint-disable-next-line react/no-did-update-set-state | ||
this.setState({ | ||
screensaverIsOpen: false, | ||
}); | ||
forceCloseScreenSaver(false); | ||
} | ||
} | ||
@@ -178,4 +189,7 @@ | ||
}, | ||
forceCloseScreenSaver: (value: ?boolean) => { | ||
dispatch(ScreenSaverActions.forceCloseScreenSaver(value)); | ||
}, | ||
}); | ||
export default connect(mapStateToProps, mapDispatchToProps)(ScreenSaver); |
@@ -6,2 +6,3 @@ // @flow | ||
export const FORCE_OPEN_SCREEN_SAVER = 'FORCE_OPEN_SCREEN_SAVER'; | ||
export const FORCE_CLOSE_SCREEN_SAVER = 'FORCE_CLOSE_SCREEN_SAVER'; | ||
@@ -34,1 +35,10 @@ export function appClick(click) { | ||
} | ||
export function forceCloseScreenSaver(value) { | ||
return (dispatch) => { | ||
dispatch({ | ||
type: FORCE_CLOSE_SCREEN_SAVER, | ||
payload: value | ||
}); | ||
}; | ||
} |
// @flow | ||
import { APP_CLICK, SCREEN_SAVER_CLOSE, FORCE_OPEN_SCREEN_SAVER } from './ScreenSaverActions'; | ||
import { | ||
APP_CLICK, SCREEN_SAVER_CLOSE, FORCE_OPEN_SCREEN_SAVER, FORCE_CLOSE_SCREEN_SAVER | ||
} from './ScreenSaverActions'; | ||
@@ -8,3 +10,4 @@ const initialState = { | ||
screenSaverClose: false, | ||
forceOpen: false | ||
forceOpen: false, | ||
forceClose: false | ||
}; | ||
@@ -26,2 +29,6 @@ | ||
}); | ||
case FORCE_CLOSE_SCREEN_SAVER: | ||
return Object.assign({}, state, { | ||
forceClose: action.payload | ||
}); | ||
default: | ||
@@ -28,0 +35,0 @@ return state; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14642
270
127