@vnejs/module.controller.audio 0.2.2 → 0.2.4

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.
package/dist/index.d.ts CHANGED
@@ -6,9 +6,9 @@ export declare abstract class ModuleControllerAudio<TEvents extends ModuleContro
6
6
  abstract AUDIO_NAME: string;
7
7
  abstract AUDIO_START_DURATION: number;
8
8
  abstract VOLUME_SETTING: string;
9
- abstract SHOW_EVENT: string;
10
- abstract HIDE_EVENT: string;
11
- abstract LOAD_EVENT: string;
9
+ abstract EVENT_SHOW: string;
10
+ abstract EVENT_HIDE: string;
11
+ abstract EVENT_LOAD: string;
12
12
  PARAMS_ALL: {
13
13
  layer: string;
14
14
  name: string;
package/dist/index.js CHANGED
@@ -6,9 +6,9 @@ export class ModuleControllerAudio extends ModuleCore {
6
6
  subscribe = () => {
7
7
  if (!this.AUDIO_NAME)
8
8
  return;
9
- this.on(this.SHOW_EVENT, this.onShow);
10
- this.on(this.HIDE_EVENT, this.onHide);
11
- this.on(this.LOAD_EVENT, this.onLoad);
9
+ this.on(this.EVENT_SHOW, this.onShow);
10
+ this.on(this.EVENT_HIDE, this.onHide);
11
+ this.on(this.EVENT_LOAD, this.onLoad);
12
12
  this.on(this.EVENTS.STATE.SET, this.onHide);
13
13
  this.on(this.EVENTS.STATE.CLEAR, this.onHide);
14
14
  this.on(this.EVENTS.AUDIO.VOLUME_CHANGED, this.onVolumeChanged);
@@ -21,7 +21,7 @@ export class ModuleControllerAudio extends ModuleCore {
21
21
  onShow = () => {
22
22
  this.isPlaying = true;
23
23
  this.emit(this.EVENTS.AUDIO.GLOBAL_PAUSE, this.PARAMS_DURATION);
24
- this.emit(this.EVENTS.AUDIO.PLAY, this.PARAMS_ALL);
24
+ this.emit(this.EVENTS.AUDIO.PLAY, { ...this.PARAMS_ALL, volume: this.getRealVolume() });
25
25
  };
26
26
  onHide = () => {
27
27
  this.isPlaying = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/module.controller.audio",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -15,11 +15,12 @@ export abstract class ModuleControllerAudio<
15
15
 
16
16
  abstract AUDIO_NAME: string;
17
17
  abstract AUDIO_START_DURATION: number;
18
+
18
19
  abstract VOLUME_SETTING: string;
19
20
 
20
- abstract SHOW_EVENT: string;
21
- abstract HIDE_EVENT: string;
22
- abstract LOAD_EVENT: string;
21
+ abstract EVENT_SHOW: string;
22
+ abstract EVENT_HIDE: string;
23
+ abstract EVENT_LOAD: string;
23
24
 
24
25
  PARAMS_ALL!: { layer: string; name: string; duration: number };
25
26
  PARAMS_DURATION!: { duration: number };
@@ -29,9 +30,9 @@ export abstract class ModuleControllerAudio<
29
30
  subscribe = () => {
30
31
  if (!this.AUDIO_NAME) return;
31
32
 
32
- this.on(this.SHOW_EVENT, this.onShow);
33
- this.on(this.HIDE_EVENT, this.onHide);
34
- this.on(this.LOAD_EVENT, this.onLoad);
33
+ this.on(this.EVENT_SHOW, this.onShow);
34
+ this.on(this.EVENT_HIDE, this.onHide);
35
+ this.on(this.EVENT_LOAD, this.onLoad);
35
36
 
36
37
  this.on(this.EVENTS.STATE.SET, this.onHide);
37
38
  this.on(this.EVENTS.STATE.CLEAR, this.onHide);
@@ -48,7 +49,7 @@ export abstract class ModuleControllerAudio<
48
49
  onShow = () => {
49
50
  this.isPlaying = true;
50
51
  this.emit(this.EVENTS.AUDIO.GLOBAL_PAUSE, this.PARAMS_DURATION);
51
- this.emit(this.EVENTS.AUDIO.PLAY, this.PARAMS_ALL);
52
+ this.emit(this.EVENTS.AUDIO.PLAY, { ...this.PARAMS_ALL, volume: this.getRealVolume() });
52
53
  };
53
54
  onHide = () => {
54
55
  this.isPlaying = false;