@vnejs/plugins.view.coralina.mainmenu 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,7 +31,10 @@ export class MainMenuController extends ModuleController {
31
31
  this.on(this.EVENTS.STATE.SET, this.onHideForce);
32
32
  this.on(this.EVENTS.STATE.CLEAR, this.onHideForce);
33
33
  this.on(this.EVENTS.STATE.CLEAR, this.loadBgMedia);
34
+
34
35
  this.on(this.EVENTS.SYSTEM.STARTED, this.loadBgMedia);
36
+
37
+ this.on(this.EVENTS.MEMORY.CLEARED, this.onMemoryCleared);
35
38
  };
36
39
 
37
40
  beforeShow = async () => {
@@ -45,5 +48,7 @@ export class MainMenuController extends ModuleController {
45
48
  onAccept = async () => this.click((await this.emitOne(this.EVENTS.MAINMENU.ITEMS)).filter(onRealItems), this.currentItem);
46
49
  onClick = async ({ index } = {}) => this.click(await this.emitOne(this.EVENTS.MAINMENU.ITEMS), index);
47
50
 
51
+ onMemoryCleared = async () => this.updateStateAndView({ bgSrc: (await this.loadBgMedia()).src });
52
+
48
53
  click = (items, index) => index !== null && items[index]?.onClick?.();
49
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.view.coralina.mainmenu",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
package/view/index.jsx CHANGED
@@ -23,12 +23,13 @@ const MainMenuControls = ({ locs = EMPTY_OBJ, currentItem = null, realItems = EM
23
23
  };
24
24
 
25
25
  const MainMenu = ({ store, onMount, ...props } = EMPTY_OBJ) => {
26
- const [{ isShow = false, items = EMPTY_ARRAY, bgSrc = "", currentItem = null, realItems = EMPTY_ARRAY, locs = EMPTY_OBJ }, setState] = useState(EMPTY_OBJ);
26
+ const [{ isShow = false, isForce = false, items = EMPTY_ARRAY, bgSrc = "", currentItem = null, realItems = EMPTY_ARRAY, locs = EMPTY_OBJ }, setState] =
27
+ useState(EMPTY_OBJ);
27
28
 
28
29
  useEffect(() => store.subscribe(setState), EMPTY_ARRAY);
29
30
  useEffect(() => void onMount(), EMPTY_ARRAY);
30
31
 
31
- const propsScreen = useMemo(() => ({ ...props.PARAMS.MAINMENU_VIEW.VIEW_PROPS.screen, bgSrc, isShow }), [bgSrc, isShow]);
32
+ const propsScreen = useMemo(() => ({ ...props.PARAMS.MAINMENU_VIEW.VIEW_PROPS.screen, bgSrc, isShow, isForce }), [bgSrc, isShow, isForce]);
32
33
  const propsControls = useMemo(() => ({ ...props, items, realItems, currentItem, locs }), [items, realItems, currentItem, locs]);
33
34
 
34
35
  return (