@flowplayer/spins 0.1.0-rc.7 → 0.1.0-rc.8

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/types.d.ts CHANGED
@@ -13,6 +13,10 @@ declare const SPIN_CREATED = "spin:created";
13
13
  * Emitted when a different spin enters the viewport.
14
14
  */
15
15
  declare const SPIN_IN_VIEWPORT = "spin:viewport";
16
+ /**
17
+ * Should be emitted in order to add more spins dynamically.
18
+ */
19
+ declare const ADD_SPINS = "spins:add";
16
20
 
17
21
  /**
18
22
  * All supported plugin identifiers for configuring the player.
@@ -48,28 +52,38 @@ type SpinEventData = {
48
52
  config: SpinItem;
49
53
  spin: HTMLElement;
50
54
  };
55
+ type AddSpinsEventData = SpinItem[];
51
56
  interface SpinsContainer extends HTMLDivElement {
52
57
  /**
53
- * Ads a listener for the SpinsEvents["SPIN_CREATED"] event
58
+ * Adds a listener for the SpinsEvents["SPIN_CREATED"] event
54
59
  */
55
60
  on(e: typeof SPIN_CREATED, handler: (e: CustomEvent<SpinEventData>) => void, options?: boolean | AddEventListenerOptions): void;
56
61
  /**
57
- * Ads a listener for the SpinsEvents["SPIN_IN_VIEWPORT"] event.
62
+ * Adds a listener for the SpinsEvents["SPIN_IN_VIEWPORT"] event.
58
63
  */
59
64
  on(e: typeof SPIN_IN_VIEWPORT, handler: (e: CustomEvent<SpinEventData>) => void, options?: boolean | AddEventListenerOptions): void;
60
65
  /**
61
66
  * Removes a listener for the SpinsEvents["SPIN_IN_VIEWPORT"] event
62
67
  */
63
- off<T>(e: typeof SPIN_IN_VIEWPORT, handler: (e: CustomEvent<T>) => void): void;
68
+ off(e: typeof SPIN_IN_VIEWPORT, handler: (e: CustomEvent<SpinEventData>) => void): void;
64
69
  /**
65
70
  * Removes a listener for the SpinsEvents["SPIN_CREATED"] event
66
71
  */
67
- off<T>(e: typeof SPIN_CREATED, handler: (e: CustomEvent<T>) => void): void;
72
+ off(e: typeof SPIN_CREATED, handler: (e: CustomEvent<SpinEventData>) => void): void;
73
+ /**
74
+ * Triggers dynamic addition of new spins
75
+ */
76
+ emit(e: typeof ADD_SPINS, data: AddSpinsEventData): void;
77
+ /**
78
+ * All the spins events.
79
+ */
80
+ events: typeof events;
68
81
  }
69
82
  declare const events: {
70
83
  SPIN_IN_VIEWPORT: typeof SPIN_IN_VIEWPORT;
71
84
  SPIN_CREATED: typeof SPIN_CREATED;
85
+ ADD_SPINS: typeof ADD_SPINS;
72
86
  };
73
87
  declare function createSpins(config: SpinsConfig): SpinsContainer;
74
88
 
75
- export { type SpinEventData, type SpinItem, type SpinsConfig, type SpinsContainer, createSpins, events };
89
+ export { type AddSpinsEventData, type SpinEventData, type SpinItem, type SpinsConfig, type SpinsContainer, createSpins, events };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flowplayer/spins",
3
3
  "module": "dist/index.js",
4
- "version": "0.1.0-rc.7",
4
+ "version": "0.1.0-rc.8",
5
5
  "type": "module",
6
6
  "types": "./dist/types.d.ts",
7
7
  "exports": {