@vnejs/plugins.settings.potato 0.1.14 → 0.1.15

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.
@@ -9,5 +9,4 @@ export declare class Potato extends ModuleCore<PotatoPluginEvents, PotatoPluginC
9
9
  init: () => Promise<void>;
10
10
  onSettingChange: ({ name, value }: SettingsChangedResult) => false | Promise<unknown[]> | undefined;
11
11
  onPotatoEmit: ({ value }?: PotatoEmitPayload) => void;
12
- notPotato: (e: string) => boolean;
13
12
  }
@@ -14,16 +14,14 @@ export class Potato extends ModuleCore {
14
14
  };
15
15
  onSettingChange = ({ name, value }) => name === this.SETTINGS.POTATO.ENABLED && this.emit(this.EVENTS.POTATO.EMIT, { value: Boolean(value) });
16
16
  onPotatoEmit = ({ value } = {}) => {
17
- if (value) {
18
- this.shared.mediaNoTimeoutSources.push(this.CONST.POTATO.SOURCE);
19
- this.shared.viewForceAnimationSources.push(this.CONST.POTATO.SOURCE);
17
+ const enabled = Boolean(value);
18
+ this.shared.mediaNoTimeoutSources.set(this.CONST.POTATO.SOURCE, enabled);
19
+ this.shared.viewForceAnimationSources.set(this.CONST.POTATO.SOURCE, enabled);
20
+ if (enabled) {
20
21
  this.styleElement && document.head.appendChild(this.styleElement);
21
22
  }
22
23
  else {
23
- this.shared.mediaNoTimeoutSources = this.shared.mediaNoTimeoutSources.filter(this.notPotato);
24
- this.shared.viewForceAnimationSources = this.shared.viewForceAnimationSources.filter(this.notPotato);
25
24
  this.styleElement?.isConnected && document.head.removeChild(this.styleElement);
26
25
  }
27
26
  };
28
- notPotato = (e) => e !== this.CONST.POTATO.SOURCE;
29
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.settings.potato",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,16 +28,15 @@ export class Potato extends ModuleCore<PotatoPluginEvents, PotatoPluginConstants
28
28
  name === this.SETTINGS.POTATO.ENABLED && this.emit(this.EVENTS.POTATO.EMIT, { value: Boolean(value) } satisfies PotatoEmitPayload);
29
29
 
30
30
  onPotatoEmit = ({ value }: PotatoEmitPayload = {}) => {
31
- if (value) {
32
- this.shared.mediaNoTimeoutSources.push(this.CONST.POTATO.SOURCE);
33
- this.shared.viewForceAnimationSources.push(this.CONST.POTATO.SOURCE);
31
+ const enabled = Boolean(value);
32
+
33
+ this.shared.mediaNoTimeoutSources.set(this.CONST.POTATO.SOURCE, enabled);
34
+ this.shared.viewForceAnimationSources.set(this.CONST.POTATO.SOURCE, enabled);
35
+
36
+ if (enabled) {
34
37
  this.styleElement && document.head.appendChild(this.styleElement);
35
38
  } else {
36
- this.shared.mediaNoTimeoutSources = this.shared.mediaNoTimeoutSources.filter(this.notPotato);
37
- this.shared.viewForceAnimationSources = this.shared.viewForceAnimationSources.filter(this.notPotato);
38
39
  this.styleElement?.isConnected && document.head.removeChild(this.styleElement);
39
40
  }
40
41
  };
41
-
42
- notPotato = (e: string) => e !== this.CONST.POTATO.SOURCE;
43
42
  }