@100mslive/react-native-hms 1.5.0 → 1.6.0

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.
Files changed (88) hide show
  1. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +52 -24
  2. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +245 -62
  3. package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +15 -6
  4. package/ios/HMSConstants.swift +3 -1
  5. package/ios/HMSDecoder.swift +1 -1
  6. package/ios/HMSHelper.swift +44 -7
  7. package/ios/HMSManager.m +8 -0
  8. package/ios/HMSManager.swift +35 -1
  9. package/ios/HMSRNSDK.swift +268 -38
  10. package/lib/commonjs/classes/HMSAudioTrackSettings.js +14 -0
  11. package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
  12. package/lib/commonjs/classes/HMSEncoder.js +2 -1
  13. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  14. package/lib/commonjs/classes/HMSIOSAudioMode.js +13 -0
  15. package/lib/commonjs/classes/HMSIOSAudioMode.js.map +1 -0
  16. package/lib/commonjs/classes/HMSSDK.js +50 -0
  17. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  18. package/lib/commonjs/classes/HMSSessionStore.js +173 -0
  19. package/lib/commonjs/classes/HMSSessionStore.js.map +1 -0
  20. package/lib/commonjs/classes/HMSUpdateListenerActions.js +8 -0
  21. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  22. package/lib/commonjs/classes/HMSVideoTrackSettings.js +5 -0
  23. package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
  24. package/lib/commonjs/index.js +12 -0
  25. package/lib/commonjs/index.js.map +1 -1
  26. package/lib/commonjs/utils/emitter/EventEmitter.js +162 -0
  27. package/lib/commonjs/utils/emitter/EventEmitter.js.map +1 -0
  28. package/lib/commonjs/utils/emitter/_EmitterSubscription.js +46 -0
  29. package/lib/commonjs/utils/emitter/_EmitterSubscription.js.map +1 -0
  30. package/lib/commonjs/utils/emitter/_EventSubscription.js +36 -0
  31. package/lib/commonjs/utils/emitter/_EventSubscription.js.map +1 -0
  32. package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js +90 -0
  33. package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js.map +1 -0
  34. package/lib/commonjs/utils/index.js +17 -0
  35. package/lib/commonjs/utils/index.js.map +1 -0
  36. package/lib/module/classes/HMSAudioTrackSettings.js +14 -0
  37. package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
  38. package/lib/module/classes/HMSEncoder.js +2 -1
  39. package/lib/module/classes/HMSEncoder.js.map +1 -1
  40. package/lib/module/classes/HMSIOSAudioMode.js +6 -0
  41. package/lib/module/classes/HMSIOSAudioMode.js.map +1 -0
  42. package/lib/module/classes/HMSSDK.js +50 -0
  43. package/lib/module/classes/HMSSDK.js.map +1 -1
  44. package/lib/module/classes/HMSSessionStore.js +166 -0
  45. package/lib/module/classes/HMSSessionStore.js.map +1 -0
  46. package/lib/module/classes/HMSUpdateListenerActions.js +8 -0
  47. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  48. package/lib/module/classes/HMSVideoTrackSettings.js +5 -0
  49. package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
  50. package/lib/module/index.js +1 -0
  51. package/lib/module/index.js.map +1 -1
  52. package/lib/module/utils/emitter/EventEmitter.js +151 -0
  53. package/lib/module/utils/emitter/EventEmitter.js.map +1 -0
  54. package/lib/module/utils/emitter/_EmitterSubscription.js +39 -0
  55. package/lib/module/utils/emitter/_EmitterSubscription.js.map +1 -0
  56. package/lib/module/utils/emitter/_EventSubscription.js +29 -0
  57. package/lib/module/utils/emitter/_EventSubscription.js.map +1 -0
  58. package/lib/module/utils/emitter/_EventSubscriptionVendor.js +83 -0
  59. package/lib/module/utils/emitter/_EventSubscriptionVendor.js.map +1 -0
  60. package/lib/module/utils/index.js +2 -0
  61. package/lib/module/utils/index.js.map +1 -0
  62. package/lib/typescript/classes/HMSAudioTrackSettings.d.ts +14 -0
  63. package/lib/typescript/classes/HMSIOSAudioMode.d.ts +4 -0
  64. package/lib/typescript/classes/HMSSDK.d.ts +16 -0
  65. package/lib/typescript/classes/HMSSessionStore.d.ts +63 -0
  66. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +9 -1
  67. package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +5 -0
  68. package/lib/typescript/index.d.ts +2 -0
  69. package/lib/typescript/utils/emitter/EventEmitter.d.ts +91 -0
  70. package/lib/typescript/utils/emitter/_EmitterSubscription.d.ts +29 -0
  71. package/lib/typescript/utils/emitter/_EventSubscription.d.ts +19 -0
  72. package/lib/typescript/utils/emitter/_EventSubscriptionVendor.d.ts +44 -0
  73. package/lib/typescript/utils/index.d.ts +1 -0
  74. package/package.json +21 -2
  75. package/sdk-versions.json +2 -2
  76. package/src/classes/HMSAudioTrackSettings.ts +16 -0
  77. package/src/classes/HMSEncoder.ts +1 -0
  78. package/src/classes/HMSIOSAudioMode.ts +4 -0
  79. package/src/classes/HMSSDK.tsx +70 -4
  80. package/src/classes/HMSSessionStore.ts +209 -0
  81. package/src/classes/HMSUpdateListenerActions.ts +8 -0
  82. package/src/classes/HMSVideoTrackSettings.ts +5 -0
  83. package/src/index.ts +5 -0
  84. package/src/utils/emitter/EventEmitter.ts +160 -0
  85. package/src/utils/emitter/_EmitterSubscription.ts +44 -0
  86. package/src/utils/emitter/_EventSubscription.ts +28 -0
  87. package/src/utils/emitter/_EventSubscriptionVendor.ts +89 -0
  88. package/src/utils/index.ts +1 -0
@@ -0,0 +1,166 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import { NativeModules, DeviceEventEmitter } from 'react-native';
5
+ import { HMSConstants } from './HMSConstants';
6
+ import { getLogger } from './HMSLogger';
7
+ import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
8
+ import { EventEmitter } from '../utils';
9
+ const {
10
+ HMSManager
11
+ } = NativeModules;
12
+ /**
13
+ * Session store is a shared realtime key-value store that is accessible by everyone in the room.
14
+ * It can be utilized to implement features such as pinned text, spotlight (which brings a particular
15
+ * peer to the center stage for everyone in the room) and more.
16
+ *
17
+ * To get an instance of `HMSSessionStore` class, You can add an event listener for `ON_SESSION_STORE_AVAILABLE`
18
+ * event on the `HMSSDK` instance
19
+ *
20
+ * For example:
21
+ * ```
22
+ * hmsInstance.addEventListener(HMSUpdateListenerActions.ON_SESSION_STORE_AVAILABLE, <your callback function>);
23
+ * ```
24
+ *
25
+ * Checkout Session Store docs fore more details ${@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/room/session-store}
26
+ */
27
+ export class HMSSessionStore {
28
+ constructor() {
29
+ _defineProperty(this, "_deviceEventEmitterSubscription", void 0);
30
+ _defineProperty(this, "_eventEmitter", void 0);
31
+ _defineProperty(this, "_addedKeyChangeListenerCount", 0);
32
+ }
33
+ /**
34
+ * This method sets a value for a specific key on session store.
35
+ * Once a value is assigned, it will be available for other peers in the room
36
+ * who are listening for changes in value for that specific key.
37
+ *
38
+ * @param {HMSSessionStoreValue} value
39
+ * @param {string} key
40
+ * @returns {Promise}
41
+ */
42
+ async set(value, key) {
43
+ const data = await HMSManager.setSessionMetadataForKey({
44
+ id: HMSConstants.DEFAULT_SDK_ID,
45
+ key,
46
+ value
47
+ });
48
+ return data;
49
+ }
50
+
51
+ /**
52
+ * This method returns the value of any specified key on session store.
53
+ * Note that you will not get updates for any change in value of the specified key,
54
+ * It returns the latest value at the time it was called.
55
+ *
56
+ * To listen to value change updates use `addKeyChangeListener` method instead.
57
+ *
58
+ * @param {string} key
59
+ * @returns {Promise}
60
+ */
61
+ async get(key) {
62
+ const data = await HMSManager.getSessionMetadataForKey({
63
+ id: HMSConstants.DEFAULT_SDK_ID,
64
+ key
65
+ });
66
+ return data;
67
+ }
68
+
69
+ /**
70
+ * This method registers a callback function for listening to value changes of a particular key.
71
+ * Registered Callback function will be called initially with latest value and whenever the value updates
72
+ *
73
+ * @param {string[]} forKeys
74
+ * @param {Function} callback
75
+ * @returns {Object} subscription object
76
+ */
77
+ addKeyChangeListener(forKeys, callback) {
78
+ // Add Native Device Event Emitter if it is not already added
79
+ if (!this._deviceEventEmitterSubscription) {
80
+ this._deviceEventEmitterSubscription = DeviceEventEmitter.addListener(HMSUpdateListenerActions.ON_SESSION_STORE_CHANGED, this._deviceEventEmitterListener.bind(this));
81
+ }
82
+
83
+ // Create JS side EventEmitter
84
+ if (!this._eventEmitter) {
85
+ this._eventEmitter = new EventEmitter();
86
+ }
87
+
88
+ // Unique Identifier for adding native event listener
89
+ const uniqueId = forKeys.join('') + '_' + Date.now().toString();
90
+ const eventEmitter = this._eventEmitter;
91
+
92
+ // Add listeners on eventEmitter for each key
93
+ const subscriptions = forKeys.map(key => eventEmitter.addListener(key, callback, {
94
+ uniqueId
95
+ }));
96
+
97
+ //
98
+ let cleanupHandler = () => {
99
+ this._cleanup(subscriptions);
100
+ };
101
+
102
+ // Adding 'KeyChangeListener' on native side
103
+ HMSManager.addKeyChangeListener({
104
+ id: HMSConstants.DEFAULT_SDK_ID,
105
+ keys: forKeys,
106
+ uniqueId
107
+ })
108
+ // Adding 'KeyChangeListener' fails on native side
109
+ .catch(err => {
110
+ if (typeof cleanupHandler === 'function') {
111
+ callback(err, null);
112
+ cleanupHandler();
113
+ cleanupHandler = null;
114
+ }
115
+ });
116
+ this._addedKeyChangeListenerCount += 1;
117
+ return {
118
+ remove: () => {
119
+ if (typeof cleanupHandler === 'function') {
120
+ cleanupHandler();
121
+ cleanupHandler = null;
122
+ }
123
+ }
124
+ };
125
+ }
126
+ _cleanup(subscriptionsToRemove) {
127
+ // Extracting `uniqueId` from first subscription (all subscriptions have same uniqueId)
128
+ // this `uniqueId` will be used to remove 'KeyChangeListener' from native side
129
+ const uniqueId = subscriptionsToRemove.length > 0 ? subscriptionsToRemove[0].context.uniqueId : null;
130
+
131
+ // Removing required subscriptions from 'eventEmitter'
132
+ subscriptionsToRemove.forEach(subscription => subscription.remove());
133
+
134
+ // Removing 'KeyChangeListener' from native side
135
+ HMSManager.removeKeyChangeListener({
136
+ id: HMSConstants.DEFAULT_SDK_ID,
137
+ uniqueId
138
+ }).catch(error => {
139
+ const logger = getLogger();
140
+ logger === null || logger === void 0 ? void 0 : logger.verbose("Error while removing key change listener, Listener didn't get registerred at first place or was already removed", error);
141
+ });
142
+ this._addedKeyChangeListenerCount -= 1;
143
+ if (this._addedKeyChangeListenerCount <= 0) {
144
+ this._addedKeyChangeListenerCount = 0;
145
+ if (this._deviceEventEmitterSubscription && Object.getOwnPropertyNames(this._deviceEventEmitterSubscription).includes('remove') && typeof this._deviceEventEmitterSubscription.remove === 'function') {
146
+ this._deviceEventEmitterSubscription.remove();
147
+ } else {
148
+ DeviceEventEmitter.removeListener(HMSUpdateListenerActions.ON_SESSION_STORE_CHANGED, this._deviceEventEmitterListener);
149
+ }
150
+ this._deviceEventEmitterSubscription = undefined;
151
+ this._eventEmitter = undefined;
152
+ }
153
+ }
154
+ _deviceEventEmitterListener(data) {
155
+ var _getLogger, _this$_eventEmitter;
156
+ // if id is different from default sdk_id, return early
157
+ if (data.id !== HMSConstants.DEFAULT_SDK_ID) {
158
+ return;
159
+ }
160
+
161
+ // emit event for the key
162
+ (_getLogger = getLogger()) === null || _getLogger === void 0 ? void 0 : _getLogger.verbose('#Listener ON_SESSION_STORE_CHANGED event: ', data);
163
+ (_this$_eventEmitter = this._eventEmitter) === null || _this$_eventEmitter === void 0 ? void 0 : _this$_eventEmitter.emit(data.key, null, data);
164
+ }
165
+ }
166
+ //# sourceMappingURL=HMSSessionStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","DeviceEventEmitter","HMSConstants","getLogger","HMSUpdateListenerActions","EventEmitter","HMSManager","HMSSessionStore","constructor","_defineProperty","set","value","key","data","setSessionMetadataForKey","id","DEFAULT_SDK_ID","get","getSessionMetadataForKey","addKeyChangeListener","forKeys","callback","_deviceEventEmitterSubscription","addListener","ON_SESSION_STORE_CHANGED","_deviceEventEmitterListener","bind","_eventEmitter","uniqueId","join","Date","now","toString","eventEmitter","subscriptions","map","cleanupHandler","_cleanup","keys","catch","err","_addedKeyChangeListenerCount","remove","subscriptionsToRemove","length","context","forEach","subscription","removeKeyChangeListener","error","logger","verbose","Object","getOwnPropertyNames","includes","removeListener","undefined","_getLogger","_this$_eventEmitter","emit"],"sources":["HMSSessionStore.ts"],"sourcesContent":["import {\n NativeModules,\n DeviceEventEmitter,\n EmitterSubscription as RNEmitterSubscription,\n} from 'react-native';\nimport { HMSConstants } from './HMSConstants';\nimport { getLogger } from './HMSLogger';\nimport { HMSUpdateListenerActions } from './HMSUpdateListenerActions';\nimport { EventEmitter } from '../utils';\nimport type { EmitterSubscription } from '../utils';\n\nconst { HMSManager } = NativeModules;\n\ntype Nullable<T> = T | null | undefined;\n\nexport type HMSSessionStoreValue = Nullable<string>;\n\n/**\n * Session store is a shared realtime key-value store that is accessible by everyone in the room.\n * It can be utilized to implement features such as pinned text, spotlight (which brings a particular\n * peer to the center stage for everyone in the room) and more.\n *\n * To get an instance of `HMSSessionStore` class, You can add an event listener for `ON_SESSION_STORE_AVAILABLE`\n * event on the `HMSSDK` instance\n *\n * For example:\n * ```\n * hmsInstance.addEventListener(HMSUpdateListenerActions.ON_SESSION_STORE_AVAILABLE, <your callback function>);\n * ```\n *\n * Checkout Session Store docs fore more details ${@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/room/session-store}\n */\nexport class HMSSessionStore {\n private _deviceEventEmitterSubscription?: RNEmitterSubscription;\n private _eventEmitter?: EventEmitter;\n private _addedKeyChangeListenerCount = 0;\n\n /**\n * This method sets a value for a specific key on session store.\n * Once a value is assigned, it will be available for other peers in the room\n * who are listening for changes in value for that specific key.\n *\n * @param {HMSSessionStoreValue} value\n * @param {string} key\n * @returns {Promise}\n */\n async set(value: HMSSessionStoreValue, key: string) {\n const data: { success: true; finalValue: HMSSessionStoreValue } =\n await HMSManager.setSessionMetadataForKey({\n id: HMSConstants.DEFAULT_SDK_ID,\n key,\n value,\n });\n return data;\n }\n\n /**\n * This method returns the value of any specified key on session store.\n * Note that you will not get updates for any change in value of the specified key,\n * It returns the latest value at the time it was called.\n *\n * To listen to value change updates use `addKeyChangeListener` method instead.\n *\n * @param {string} key\n * @returns {Promise}\n */\n async get(key: string) {\n const data: HMSSessionStoreValue =\n await HMSManager.getSessionMetadataForKey({\n id: HMSConstants.DEFAULT_SDK_ID,\n key,\n });\n return data;\n }\n\n /**\n * This method registers a callback function for listening to value changes of a particular key.\n * Registered Callback function will be called initially with latest value and whenever the value updates\n *\n * @param {string[]} forKeys\n * @param {Function} callback\n * @returns {Object} subscription object\n */\n addKeyChangeListener<T extends string[]>(\n forKeys: T,\n callback: (\n error: string | null,\n data: { key: T[number]; value: HMSSessionStoreValue } | null\n ) => void\n ) {\n // Add Native Device Event Emitter if it is not already added\n if (!this._deviceEventEmitterSubscription) {\n this._deviceEventEmitterSubscription = DeviceEventEmitter.addListener(\n HMSUpdateListenerActions.ON_SESSION_STORE_CHANGED,\n this._deviceEventEmitterListener.bind(this)\n );\n }\n\n // Create JS side EventEmitter\n if (!this._eventEmitter) {\n this._eventEmitter = new EventEmitter();\n }\n\n // Unique Identifier for adding native event listener\n const uniqueId = forKeys.join('') + '_' + Date.now().toString();\n\n const eventEmitter = this._eventEmitter;\n\n // Add listeners on eventEmitter for each key\n const subscriptions = forKeys.map((key) =>\n eventEmitter.addListener(key, callback, { uniqueId })\n );\n\n //\n let cleanupHandler: (() => void) | null = () => {\n this._cleanup(subscriptions);\n };\n\n // Adding 'KeyChangeListener' on native side\n HMSManager.addKeyChangeListener({\n id: HMSConstants.DEFAULT_SDK_ID,\n keys: forKeys,\n uniqueId,\n })\n // Adding 'KeyChangeListener' fails on native side\n .catch((err: any) => {\n if (typeof cleanupHandler === 'function') {\n callback(err, null);\n cleanupHandler();\n cleanupHandler = null;\n }\n });\n\n this._addedKeyChangeListenerCount += 1;\n\n return {\n remove: () => {\n if (typeof cleanupHandler === 'function') {\n cleanupHandler();\n cleanupHandler = null;\n }\n },\n };\n }\n\n private _cleanup(subscriptionsToRemove: EmitterSubscription[]) {\n // Extracting `uniqueId` from first subscription (all subscriptions have same uniqueId)\n // this `uniqueId` will be used to remove 'KeyChangeListener' from native side\n const uniqueId =\n subscriptionsToRemove.length > 0\n ? (subscriptionsToRemove[0].context as { uniqueId: string }).uniqueId\n : null;\n\n // Removing required subscriptions from 'eventEmitter'\n subscriptionsToRemove.forEach((subscription) => subscription.remove());\n\n // Removing 'KeyChangeListener' from native side\n HMSManager.removeKeyChangeListener({\n id: HMSConstants.DEFAULT_SDK_ID,\n uniqueId,\n }).catch((error: any) => {\n const logger = getLogger();\n logger?.verbose(\n \"Error while removing key change listener, Listener didn't get registerred at first place or was already removed\",\n error\n );\n });\n\n this._addedKeyChangeListenerCount -= 1;\n\n if (this._addedKeyChangeListenerCount <= 0) {\n this._addedKeyChangeListenerCount = 0;\n if (\n this._deviceEventEmitterSubscription &&\n Object.getOwnPropertyNames(\n this._deviceEventEmitterSubscription\n ).includes('remove') &&\n typeof this._deviceEventEmitterSubscription.remove === 'function'\n ) {\n this._deviceEventEmitterSubscription.remove();\n } else {\n DeviceEventEmitter.removeListener(\n HMSUpdateListenerActions.ON_SESSION_STORE_CHANGED,\n this._deviceEventEmitterListener\n );\n }\n\n this._deviceEventEmitterSubscription = undefined;\n\n this._eventEmitter = undefined;\n }\n }\n\n private _deviceEventEmitterListener(data: {\n id: string;\n key: string;\n value: HMSSessionStoreValue;\n }) {\n // if id is different from default sdk_id, return early\n if (data.id !== HMSConstants.DEFAULT_SDK_ID) {\n return;\n }\n\n // emit event for the key\n getLogger()?.verbose('#Listener ON_SESSION_STORE_CHANGED event: ', data);\n\n this._eventEmitter?.emit(data.key, null, data);\n }\n}\n"],"mappings":";;;AAAA,SACEA,aAAa,EACbC,kBAAkB,QAEb,cAAc;AACrB,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,YAAY,QAAQ,UAAU;AAGvC,MAAM;EAAEC;AAAW,CAAC,GAAGN,aAAa;AAMpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,eAAe,CAAC;EAAAC,YAAA;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA,uCAGY,CAAC;EAAA;EAExC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,GAAGA,CAACC,KAA2B,EAAEC,GAAW,EAAE;IAClD,MAAMC,IAAyD,GAC7D,MAAMP,UAAU,CAACQ,wBAAwB,CAAC;MACxCC,EAAE,EAAEb,YAAY,CAACc,cAAc;MAC/BJ,GAAG;MACHD;IACF,CAAC,CAAC;IACJ,OAAOE,IAAI;EACb;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMI,GAAGA,CAACL,GAAW,EAAE;IACrB,MAAMC,IAA0B,GAC9B,MAAMP,UAAU,CAACY,wBAAwB,CAAC;MACxCH,EAAE,EAAEb,YAAY,CAACc,cAAc;MAC/BJ;IACF,CAAC,CAAC;IACJ,OAAOC,IAAI;EACb;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,oBAAoBA,CAClBC,OAAU,EACVC,QAGS,EACT;IACA;I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BAAA;IACD;IACA,IAAI7C,IAAI,CAACE,EAAE,KAAKb,YAAY,CAACc,cAAc,EAAE;MAC3C;IACF;;IAEA;IACA,CAAAyC,UAAA,GAAAtD,SAAS,EAAE,cAAAsD,UAAA,uBAAXA,UAAA,CAAaN,OAAO,CAAC,4CAA4C,EAAEtC,IAAI,CAAC;IAExE,CAAA6C,mBAAA,OAAI,CAAC/B,aAAa,cAAA+B,mBAAA,uBAAlBA,mBAAA,CAAoBC,IAAI,CAAC9C,IAAI,CAACD,GAAG,EAAE,IAAI,EAAEC,IAAI,CAAC;EAChD;AACF"}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * These are the available events emitted by the `HMSSDK`
3
+ *
4
+ * For more info about these events, checkout Event Listener docs
5
+ * {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/listen-to-room-updates/event-listeners}
6
+ */
1
7
  export let HMSUpdateListenerActions = /*#__PURE__*/function (HMSUpdateListenerActions) {
2
8
  HMSUpdateListenerActions["ON_PREVIEW"] = "ON_PREVIEW";
3
9
  HMSUpdateListenerActions["ON_JOIN"] = "ON_JOIN";
@@ -18,6 +24,8 @@ export let HMSUpdateListenerActions = /*#__PURE__*/function (HMSUpdateListenerAc
18
24
  HMSUpdateListenerActions["ON_REMOTE_AUDIO_STATS"] = "ON_REMOTE_AUDIO_STATS";
19
25
  HMSUpdateListenerActions["ON_REMOTE_VIDEO_STATS"] = "ON_REMOTE_VIDEO_STATS";
20
26
  HMSUpdateListenerActions["ON_AUDIO_DEVICE_CHANGED"] = "ON_AUDIO_DEVICE_CHANGED";
27
+ HMSUpdateListenerActions["ON_SESSION_STORE_AVAILABLE"] = "ON_SESSION_STORE_AVAILABLE";
28
+ HMSUpdateListenerActions["ON_SESSION_STORE_CHANGED"] = "ON_SESSION_STORE_CHANGED";
21
29
  return HMSUpdateListenerActions;
22
30
  }({});
23
31
  //# sourceMappingURL=HMSUpdateListenerActions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["HMSUpdateListenerActions"],"sources":["HMSUpdateListenerActions.ts"],"sourcesContent":["export enum HMSUpdateListenerActions {\n ON_PREVIEW = 'ON_PREVIEW',\n ON_JOIN = 'ON_JOIN',\n ON_ROOM_UPDATE = 'ON_ROOM_UPDATE',\n ON_PEER_UPDATE = '3',\n ON_TRACK_UPDATE = 'ON_TRACK_UPDATE',\n ON_ERROR = 'ON_ERROR',\n ON_MESSAGE = 'ON_MESSAGE',\n ON_SPEAKER = 'ON_SPEAKER',\n RECONNECTING = 'RECONNECTING',\n RECONNECTED = 'RECONNECTED',\n ON_ROLE_CHANGE_REQUEST = 'ON_ROLE_CHANGE_REQUEST',\n ON_CHANGE_TRACK_STATE_REQUEST = 'ON_CHANGE_TRACK_STATE_REQUEST',\n ON_REMOVED_FROM_ROOM = 'ON_REMOVED_FROM_ROOM',\n ON_RTC_STATS = 'ON_RTC_STATS',\n ON_LOCAL_AUDIO_STATS = 'ON_LOCAL_AUDIO_STATS',\n ON_LOCAL_VIDEO_STATS = 'ON_LOCAL_VIDEO_STATS',\n ON_REMOTE_AUDIO_STATS = 'ON_REMOTE_AUDIO_STATS',\n ON_REMOTE_VIDEO_STATS = 'ON_REMOTE_VIDEO_STATS',\n ON_AUDIO_DEVICE_CHANGED = 'ON_AUDIO_DEVICE_CHANGED',\n}\n"],"mappings":"AAAA,WAAYA,wBAAwB,0BAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA"}
1
+ {"version":3,"names":["HMSUpdateListenerActions"],"sources":["HMSUpdateListenerActions.ts"],"sourcesContent":["/**\n * These are the available events emitted by the `HMSSDK`\n *\n * For more info about these events, checkout Event Listener docs\n * {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/listen-to-room-updates/event-listeners}\n */\nexport enum HMSUpdateListenerActions {\n ON_PREVIEW = 'ON_PREVIEW',\n ON_JOIN = 'ON_JOIN',\n ON_ROOM_UPDATE = 'ON_ROOM_UPDATE',\n ON_PEER_UPDATE = '3',\n ON_TRACK_UPDATE = 'ON_TRACK_UPDATE',\n ON_ERROR = 'ON_ERROR',\n ON_MESSAGE = 'ON_MESSAGE',\n ON_SPEAKER = 'ON_SPEAKER',\n RECONNECTING = 'RECONNECTING',\n RECONNECTED = 'RECONNECTED',\n ON_ROLE_CHANGE_REQUEST = 'ON_ROLE_CHANGE_REQUEST',\n ON_CHANGE_TRACK_STATE_REQUEST = 'ON_CHANGE_TRACK_STATE_REQUEST',\n ON_REMOVED_FROM_ROOM = 'ON_REMOVED_FROM_ROOM',\n ON_RTC_STATS = 'ON_RTC_STATS',\n ON_LOCAL_AUDIO_STATS = 'ON_LOCAL_AUDIO_STATS',\n ON_LOCAL_VIDEO_STATS = 'ON_LOCAL_VIDEO_STATS',\n ON_REMOTE_AUDIO_STATS = 'ON_REMOTE_AUDIO_STATS',\n ON_REMOTE_VIDEO_STATS = 'ON_REMOTE_VIDEO_STATS',\n ON_AUDIO_DEVICE_CHANGED = 'ON_AUDIO_DEVICE_CHANGED',\n ON_SESSION_STORE_AVAILABLE = 'ON_SESSION_STORE_AVAILABLE',\n ON_SESSION_STORE_CHANGED = 'ON_SESSION_STORE_CHANGED',\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,wBAAwB,0BAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA"}
@@ -1,6 +1,11 @@
1
1
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
3
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ /**
5
+ * Customize local peer's Video track settings before Joining the Room.
6
+ *
7
+ * Checkout Track Settings docs for more details {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/track-settings}
8
+ */
4
9
  export class HMSVideoTrackSettings {
5
10
  // android only
6
11
 
@@ -1 +1 @@
1
- {"version":3,"names":["HMSVideoTrackSettings","constructor","params","_defineProperty","simulcastSettings","initialState","cameraFacing","forceSoftwareDecoder","disableAutoResize"],"sources":["HMSVideoTrackSettings.ts"],"sourcesContent":["import type { HMSSimulcastLayerSettings } from './HMSSimulcastLayerSettings';\nimport type { HMSCameraFacing } from './HMSCameraFacing';\nimport type { HMSTrackSettingsInitState } from './HMSTrackSettingsInitState';\n\nexport class HMSVideoTrackSettings {\n readonly simulcastSettings?: HMSSimulcastLayerSettings[];\n initialState?: HMSTrackSettingsInitState;\n cameraFacing?: HMSCameraFacing;\n forceSoftwareDecoder?: boolean; // android only\n disableAutoResize?: boolean; // android only\n\n constructor(params: {\n simulcastSettings?: HMSSimulcastLayerSettings[];\n initialState?: HMSTrackSettingsInitState;\n cameraFacing?: HMSCameraFacing;\n forceSoftwareDecoder?: boolean;\n disableAutoResize?: boolean;\n }) {\n this.simulcastSettings = params.simulcastSettings;\n this.initialState = params.initialState;\n this.cameraFacing = params.cameraFacing;\n this.forceSoftwareDecoder = params.forceSoftwareDecoder;\n this.disableAutoResize = params.disableAutoResize;\n }\n}\n"],"mappings":";;;AAIA,OAAO,MAAMA,qBAAqB,CAAC;EAKJ;;EAE7BC,WAAWA,CAACC,MAMX,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAT6B;IAAAA,eAAA;IAU9B,IAAI,CAACC,iBAAiB,GAAGF,MAAM,CAACE,iBAAiB;IACjD,IAAI,CAACC,YAAY,GAAGH,MAAM,CAACG,YAAY;IACvC,IAAI,CAACC,YAAY,GAAGJ,MAAM,CAACI,YAAY;IACvC,IAAI,CAACC,oBAAoB,GAAGL,MAAM,CAACK,oBAAoB;IACvD,IAAI,CAACC,iBAAiB,GAAGN,MAAM,CAACM,iBAAiB;EACnD;AACF"}
1
+ {"version":3,"names":["HMSVideoTrackSettings","constructor","params","_defineProperty","simulcastSettings","initialState","cameraFacing","forceSoftwareDecoder","disableAutoResize"],"sources":["HMSVideoTrackSettings.ts"],"sourcesContent":["import type { HMSSimulcastLayerSettings } from './HMSSimulcastLayerSettings';\nimport type { HMSCameraFacing } from './HMSCameraFacing';\nimport type { HMSTrackSettingsInitState } from './HMSTrackSettingsInitState';\n\n/**\n * Customize local peer's Video track settings before Joining the Room.\n *\n * Checkout Track Settings docs for more details {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/track-settings}\n */\nexport class HMSVideoTrackSettings {\n readonly simulcastSettings?: HMSSimulcastLayerSettings[];\n initialState?: HMSTrackSettingsInitState;\n cameraFacing?: HMSCameraFacing;\n forceSoftwareDecoder?: boolean; // android only\n disableAutoResize?: boolean; // android only\n\n constructor(params: {\n simulcastSettings?: HMSSimulcastLayerSettings[];\n initialState?: HMSTrackSettingsInitState;\n cameraFacing?: HMSCameraFacing;\n forceSoftwareDecoder?: boolean;\n disableAutoResize?: boolean;\n }) {\n this.simulcastSettings = params.simulcastSettings;\n this.initialState = params.initialState;\n this.cameraFacing = params.cameraFacing;\n this.forceSoftwareDecoder = params.forceSoftwareDecoder;\n this.disableAutoResize = params.disableAutoResize;\n }\n}\n"],"mappings":";;;AAIA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,qBAAqB,CAAC;EAKJ;;EAE7BC,WAAWA,CAACC,MAMX,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAT6B;IAAAA,eAAA;IAU9B,IAAI,CAACC,iBAAiB,GAAGF,MAAM,CAACE,iBAAiB;IACjD,IAAI,CAACC,YAAY,GAAGH,MAAM,CAACG,YAAY;IACvC,IAAI,CAACC,YAAY,GAAGJ,MAAM,CAACI,YAAY;IACvC,IAAI,CAACC,oBAAoB,GAAGL,MAAM,CAACK,oBAAoB;IACvD,IAAI,CAACC,iBAAiB,GAAGN,MAAM,CAACM,iBAAiB;EACnD;AACF"}
@@ -80,6 +80,7 @@ export * from './classes/HMSSimulcastLayerDefinition';
80
80
  export * from './classes/HMSQualityLimitationReasons';
81
81
  export * from './classes/HMSQualityLimitationReason';
82
82
  export * from './classes/HMSCameraControl';
83
+ export * from './classes/HMSIOSAudioMode';
83
84
  import { HMSSDK as HmsManager } from './classes/HMSSDK';
84
85
  export default HmsManager;
85
86
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["HMSSDK","HmsManager"],"sources":["index.ts"],"sourcesContent":["export * from './classes/HMSConfig';\nexport * from './classes/HMSUpdateListenerActions';\nexport * from './classes/HMSMessage';\nexport * from './classes/HMSVideoTrackSettings';\nexport * from './classes/HMSVideoTrack';\nexport * from './classes/HMSVideoSettings';\nexport * from './classes/HMSVideoCodec';\nexport * from './classes/HMSTrackSettings';\nexport * from './classes/HMSTrack';\nexport * from './classes/HMSTrackType';\nexport * from './classes/HMSTrackSource';\nexport * from './classes/HMSSubscribeSettings';\nexport * from './classes/HMSSimulcastSettings';\nexport * from './classes/HMSSimulcastLayerSettings';\nexport * from './classes/HMSSDK';\nexport * from './classes/HMSRoom';\nexport * from './classes/HMSRoleChangeRequest';\nexport * from './classes/HMSRole';\nexport * from './classes/HMSRemoteVideoTrack';\nexport * from './classes/HMSRemotePeer';\nexport * from './classes/HMSRemoteAudioTrack';\nexport * from './classes/HMSPublishSettings';\nexport * from './classes/HMSPermissions';\nexport * from './classes/HMSPeer';\nexport * from './classes/HMSLocalVideoTrack';\nexport * from './classes/HMSLocalPeer';\nexport * from './classes/HMSLocalAudioTrack';\nexport * from './classes/HMSHelper';\nexport * from './classes/HMSEncoder';\nexport * from './classes/HMSAudioTrackSettings';\nexport * from './classes/HMSAudioTrack';\nexport * from './classes/HMSAudioSettings';\nexport * from './classes/HMSAudioCodec';\nexport * from './classes/HMSPeerUpdate';\nexport * from './classes/HMSRoomUpdate';\nexport * from './classes/HMSTrackUpdate';\nexport * from './classes/HMSLogger';\nexport * from './classes/HMSLogLevel';\nexport * from './classes/HMSVideoViewMode';\nexport * from './classes/HMSChangeTrackStateRequest';\nexport * from './classes/HMSSpeaker';\nexport * from './classes/HMSCameraFacing';\nexport * from './classes/HMSException';\nexport * from './classes/HMSRtmpStreamingState';\nexport * from './classes/HMSServerRecordingState';\nexport * from './classes/HMSBrowserRecordingState';\nexport * from './classes/HMSRTMPConfig';\nexport * from './classes/HMSHLSConfig';\nexport * from './classes/HMSHLSMeetingURLVariant';\nexport * from './classes/HMSHLSVariant';\nexport * from './classes/HMSHLSStreamingState';\nexport * from './classes/HMSVideoResolution';\nexport * from './classes/HMSLocalAudioStats';\nexport * from './classes/HMSLocalVideoStats';\nexport * from './classes/HMSRTCStats';\nexport * from './classes/HMSRTCStatsReport';\nexport * from './classes/HMSRemoteAudioStats';\nexport * from './classes/HMSRemoteVideoStats';\nexport * from './classes/HMSHLSRecordingConfig';\nexport * from './classes/HMSHLSRecordingState';\nexport * from './classes/HMSMessageRecipient';\nexport * from './classes/HMSMessageRecipientType';\nexport * from './classes/HMSNetworkQuality';\nexport * from './classes/HMSRtmpVideoResolution';\nexport * from './classes/HMSAudioDevice';\nexport * from './classes/HMSAudioMode';\nexport * from './classes/HMSAudioMixingMode';\nexport * from './classes/HMSAudioNode';\nexport * from './classes/HMSMicNode';\nexport * from './classes/HMSScreenBroadcastAudioReceiverNode';\nexport * from './classes/HMSAudioFilePlayerNode';\nexport * from './classes/HMSAudioMixerSource';\nexport * from './classes/HMSTrackSettingsInitState';\nexport * from './classes/HMSLogSettings';\nexport * from './classes/HMSLogAlarmManager';\nexport * from './classes/HMSMessageType';\nexport * from './classes/HMSPIPListenerActions';\nexport * from './classes/HMSLayer';\nexport * from './classes/HMSSimulcastLayerDefinition';\nexport * from './classes/HMSQualityLimitationReasons';\nexport * from './classes/HMSQualityLimitationReason';\nexport * from './classes/HMSCameraControl';\nexport type { HmsViewComponent as HMSView } from './classes/HmsView';\n\nimport { HMSSDK as HmsManager } from './classes/HMSSDK';\nexport default HmsManager;\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,oCAAoC;AAClD,cAAc,sBAAsB;AACpC,cAAc,iCAAiC;AAC/C,cAAc,yBAAyB;AACvC,cAAc,4BAA4B;AAC1C,cAAc,yBAAyB;AACvC,cAAc,4BAA4B;AAC1C,cAAc,oBAAoB;AAClC,cAAc,wBAAwB;AACtC,cAAc,0BAA0B;AACxC,cAAc,gCAAgC;AAC9C,cAAc,gCAAgC;AAC9C,cAAc,qCAAqC;AACnD,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,gCAAgC;AAC9C,cAAc,mBAAmB;AACjC,cAAc,+BAA+B;AAC7C,cAAc,yBAAyB;AACvC,cAAc,+BAA+B;AAC7C,cAAc,8BAA8B;AA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AACpD,cAAc,4BAA4B;AAG1C,SAASA,MAAM,IAAIC,UAAU,QAAQ,kBAAkB;AACvD,eAAeA,UAAU"}
1
+ {"version":3,"names":["HMSSDK","HmsManager"],"sources":["index.ts"],"sourcesContent":["export * from './classes/HMSConfig';\nexport * from './classes/HMSUpdateListenerActions';\nexport * from './classes/HMSMessage';\nexport * from './classes/HMSVideoTrackSettings';\nexport * from './classes/HMSVideoTrack';\nexport * from './classes/HMSVideoSettings';\nexport * from './classes/HMSVideoCodec';\nexport * from './classes/HMSTrackSettings';\nexport * from './classes/HMSTrack';\nexport * from './classes/HMSTrackType';\nexport * from './classes/HMSTrackSource';\nexport * from './classes/HMSSubscribeSettings';\nexport * from './classes/HMSSimulcastSettings';\nexport * from './classes/HMSSimulcastLayerSettings';\nexport * from './classes/HMSSDK';\nexport * from './classes/HMSRoom';\nexport * from './classes/HMSRoleChangeRequest';\nexport * from './classes/HMSRole';\nexport * from './classes/HMSRemoteVideoTrack';\nexport * from './classes/HMSRemotePeer';\nexport * from './classes/HMSRemoteAudioTrack';\nexport * from './classes/HMSPublishSettings';\nexport * from './classes/HMSPermissions';\nexport * from './classes/HMSPeer';\nexport * from './classes/HMSLocalVideoTrack';\nexport * from './classes/HMSLocalPeer';\nexport * from './classes/HMSLocalAudioTrack';\nexport * from './classes/HMSHelper';\nexport * from './classes/HMSEncoder';\nexport * from './classes/HMSAudioTrackSettings';\nexport * from './classes/HMSAudioTrack';\nexport * from './classes/HMSAudioSettings';\nexport * from './classes/HMSAudioCodec';\nexport * from './classes/HMSPeerUpdate';\nexport * from './classes/HMSRoomUpdate';\nexport * from './classes/HMSTrackUpdate';\nexport * from './classes/HMSLogger';\nexport * from './classes/HMSLogLevel';\nexport * from './classes/HMSVideoViewMode';\nexport * from './classes/HMSChangeTrackStateRequest';\nexport * from './classes/HMSSpeaker';\nexport * from './classes/HMSCameraFacing';\nexport * from './classes/HMSException';\nexport * from './classes/HMSRtmpStreamingState';\nexport * from './classes/HMSServerRecordingState';\nexport * from './classes/HMSBrowserRecordingState';\nexport * from './classes/HMSRTMPConfig';\nexport * from './classes/HMSHLSConfig';\nexport * from './classes/HMSHLSMeetingURLVariant';\nexport * from './classes/HMSHLSVariant';\nexport * from './classes/HMSHLSStreamingState';\nexport * from './classes/HMSVideoResolution';\nexport * from './classes/HMSLocalAudioStats';\nexport * from './classes/HMSLocalVideoStats';\nexport * from './classes/HMSRTCStats';\nexport * from './classes/HMSRTCStatsReport';\nexport * from './classes/HMSRemoteAudioStats';\nexport * from './classes/HMSRemoteVideoStats';\nexport * from './classes/HMSHLSRecordingConfig';\nexport * from './classes/HMSHLSRecordingState';\nexport * from './classes/HMSMessageRecipient';\nexport * from './classes/HMSMessageRecipientType';\nexport * from './classes/HMSNetworkQuality';\nexport * from './classes/HMSRtmpVideoResolution';\nexport * from './classes/HMSAudioDevice';\nexport * from './classes/HMSAudioMode';\nexport * from './classes/HMSAudioMixingMode';\nexport * from './classes/HMSAudioNode';\nexport * from './classes/HMSMicNode';\nexport * from './classes/HMSScreenBroadcastAudioReceiverNode';\nexport * from './classes/HMSAudioFilePlayerNode';\nexport * from './classes/HMSAudioMixerSource';\nexport * from './classes/HMSTrackSettingsInitState';\nexport * from './classes/HMSLogSettings';\nexport * from './classes/HMSLogAlarmManager';\nexport * from './classes/HMSMessageType';\nexport * from './classes/HMSPIPListenerActions';\nexport * from './classes/HMSLayer';\nexport * from './classes/HMSSimulcastLayerDefinition';\nexport * from './classes/HMSQualityLimitationReasons';\nexport * from './classes/HMSQualityLimitationReason';\nexport * from './classes/HMSCameraControl';\nexport * from './classes/HMSIOSAudioMode';\nexport type {\n HMSSessionStore,\n HMSSessionStoreValue,\n} from './classes/HMSSessionStore';\nexport type { HmsViewComponent as HMSView } from './classes/HmsView';\n\nimport { HMSSDK as HmsManager } from './classes/HMSSDK';\nexport default HmsManager;\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,oCAAoC;AAClD,cAAc,sBAAsB;AACpC,cAAc,i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Ac,6BAA6B;AAC3C,cAAc,kCAAkC;AAChD,cAAc,0BAA0B;AACxC,cAAc,wBAAwB;AACtC,cAAc,8BAA8B;AAC5C,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,+CAA+C;AAC7D,cAAc,kCAAkC;AAChD,cAAc,+BAA+B;AAC7C,cAAc,qCAAqC;AACnD,cAAc,0BAA0B;AACxC,cAAc,8BAA8B;AAC5C,cAAc,0BAA0B;AACxC,cAAc,iCAAiC;AAC/C,cAAc,oBAAoB;AAClC,cAAc,uCAAuC;AACrD,cAAc,uCAAuC;AACrD,cAAc,sCAAsC;AACpD,cAAc,4BAA4B;AAC1C,cAAc,2BAA2B;AAOzC,SAASA,MAAM,IAAIC,UAAU,QAAQ,kBAAkB;AACvD,eAAeA,UAAU"}
@@ -0,0 +1,151 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import { EmitterSubscription } from './_EmitterSubscription';
5
+ import { EventSubscriptionVendor } from './_EventSubscriptionVendor';
6
+ const sparseFilterPredicate = () => true;
7
+ export { EmitterSubscription } from './_EmitterSubscription';
8
+
9
+ /**
10
+ * @class EventEmitter
11
+ * @description
12
+ * An EventEmitter is responsible for managing a set of listeners and publishing
13
+ * events to them when it is told that such events happened. In addition to the
14
+ * data for the given event it also sends a event control object which allows
15
+ * the listeners/handlers to prevent the default behavior of the given event.
16
+ *
17
+ * The emitter is designed to be generic enough to support all the different
18
+ * contexts in which one might want to emit events. It is a simple multicast
19
+ * mechanism on top of which extra functionality can be composed. For example, a
20
+ * more advanced emitter may use an EventHolder and EventFactory.
21
+ */
22
+ export class EventEmitter {
23
+ /**
24
+ * @constructor
25
+ *
26
+ * @param {EventSubscriptionVendor} subscriber - Optional subscriber instance
27
+ * to use. If omitted, a new subscriber will be created for the emitter.
28
+ */
29
+ constructor(subscriber) {
30
+ _defineProperty(this, "_subscriber", void 0);
31
+ this._subscriber = subscriber || new EventSubscriptionVendor();
32
+ }
33
+
34
+ /**
35
+ * Adds a listener to be invoked when events of the specified type are
36
+ * emitted. An optional calling context may be provided. The data arguments
37
+ * emitted will be passed to the listener function.
38
+ *
39
+ * TODO: Annotate the listener arg's type. This is tricky because listeners
40
+ * can be invoked with varargs.
41
+ *
42
+ * @param {string} eventType - Name of the event to listen to
43
+ * @param {function} listener - Function to invoke when the specified event is
44
+ * emitted
45
+ * @param {*} context - Optional context object to use when invoking the
46
+ * listener
47
+ */
48
+ addListener(eventType, listener, context) {
49
+ return this._subscriber.addSubscription(eventType, new EmitterSubscription(this, this._subscriber, listener, context));
50
+ }
51
+
52
+ /**
53
+ * Removes all of the registered listeners, including those registered as
54
+ * listener maps.
55
+ *
56
+ * @param {?string} eventType - Optional name of the event whose registered
57
+ * listeners to remove
58
+ */
59
+ removeAllListeners(eventType) {
60
+ this._subscriber.removeAllSubscriptions(eventType);
61
+ }
62
+
63
+ /**
64
+ * Removes a specific subscription. Called by the `remove()` method of the
65
+ * subscription itself to ensure any necessary cleanup is performed.
66
+ */
67
+ removeSubscription(subscription) {
68
+ if (subscription.emitter !== this) {
69
+ console.warn('Subscription does not belong to this emitter.'); // TODO: use HMSLogger here
70
+ return;
71
+ }
72
+ this._subscriber.removeSubscription(subscription);
73
+ }
74
+
75
+ /**
76
+ * Returns the number of listeners that are currently registered for the given
77
+ * event.
78
+ *
79
+ * @param {string} eventType - Name of the event to query
80
+ * @returns {number}
81
+ */
82
+ listenerCount(eventType) {
83
+ const subscriptions = this._subscriber.getSubscriptionsForType(eventType);
84
+ return subscriptions ?
85
+ // We filter out missing entries because the array is sparse.
86
+ // "callbackfn is called only for elements of the array which actually
87
+ // exist; it is not called for missing elements of the array."
88
+ // https://www.ecma-international.org/ecma-262/9.0/index.html#sec-array.prototype.filter
89
+ subscriptions.filter(sparseFilterPredicate).length : 0;
90
+ }
91
+
92
+ /**
93
+ * Emits an event of the given type with the given data. All handlers of that
94
+ * particular type will be notified.
95
+ *
96
+ * @param {string} eventType - Name of the event to emit
97
+ * @param {...*} Arbitrary arguments to be passed to each registered listener
98
+ *
99
+ * @example
100
+ * emitter.addListener('someEvent', function(message) {
101
+ * console.log(message);
102
+ * });
103
+ *
104
+ * emitter.emit('someEvent', 'abc'); // logs 'abc'
105
+ */
106
+ emit(eventType) {
107
+ const subscriptions = this._subscriber.getSubscriptionsForType(eventType);
108
+ if (subscriptions) {
109
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
110
+ args[_key - 1] = arguments[_key];
111
+ }
112
+ for (let i = 0, l = subscriptions.length; i < l; i++) {
113
+ const subscription = subscriptions[i];
114
+
115
+ // The subscription may have been removed during this event loop.
116
+ if (subscription && subscription.listener) {
117
+ subscription.listener.apply(subscription.context, args);
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Removes the given listener for event of specific type.
125
+ *
126
+ * @param {string} eventType - Name of the event to emit
127
+ * @param {function} listener - Function to invoke when the specified event is
128
+ * emitted
129
+ *
130
+ * @example
131
+ * emitter.removeListener('someEvent', function(message) {
132
+ * console.log(message);
133
+ * }); // removes the listener if already registered
134
+ *
135
+ */
136
+ removeListener(eventType, listener) {
137
+ const subscriptions = this._subscriber.getSubscriptionsForType(eventType);
138
+ if (subscriptions) {
139
+ for (let i = 0, l = subscriptions.length; i < l; i++) {
140
+ const subscription = subscriptions[i];
141
+
142
+ // The subscription may have been removed during this event loop.
143
+ // its listener matches the listener in method parameters
144
+ if (subscription && subscription.listener === listener) {
145
+ subscription.remove();
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ //# sourceMappingURL=EventEmitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EmitterSubscription","EventSubscriptionVendor","sparseFilterPredicate","EventEmitter","constructor","subscriber","_defineProperty","_subscriber","addListener","eventType","listener","context","addSubscription","removeAllListeners","removeAllSubscriptions","removeSubscription","subscription","emitter","console","warn","listenerCount","subscriptions","getSubscriptionsForType","filter","length","emit","_len","arguments","args","Array","_key","i","l","apply","removeListener","remove"],"sources":["EventEmitter.ts"],"sourcesContent":["import { EmitterSubscription } from './_EmitterSubscription';\nimport { EventSubscriptionVendor } from './_EventSubscriptionVendor';\n\nconst sparseFilterPredicate = () => true;\n\nexport { EmitterSubscription } from './_EmitterSubscription';\n\n/**\n * @class EventEmitter\n * @description\n * An EventEmitter is responsible for managing a set of listeners and publishing\n * events to them when it is told that such events happened. In addition to the\n * data for the given event it also sends a event control object which allows\n * the listeners/handlers to prevent the default behavior of the given event.\n *\n * The emitter is designed to be generic enough to support all the different\n * contexts in which one might want to emit events. It is a simple multicast\n * mechanism on top of which extra functionality can be composed. For example, a\n * more advanced emitter may use an EventHolder and EventFactory.\n */\nexport class EventEmitter {\n _subscriber: EventSubscriptionVendor;\n\n /**\n * @constructor\n *\n * @param {EventSubscriptionVendor} subscriber - Optional subscriber instance\n * to use. If omitted, a new subscriber will be created for the emitter.\n */\n constructor(subscriber?: EventSubscriptionVendor | null) {\n this._subscriber = subscriber || new EventSubscriptionVendor();\n }\n\n /**\n * Adds a listener to be invoked when events of the specified type are\n * emitted. An optional calling context may be provided. The data arguments\n * emitted will be passed to the listener function.\n *\n * TODO: Annotate the listener arg's type. This is tricky because listeners\n * can be invoked with varargs.\n *\n * @param {string} eventType - Name of the event to listen to\n * @param {function} listener - Function to invoke when the specified event is\n * emitted\n * @param {*} context - Optional context object to use when invoking the\n * listener\n */\n addListener(\n eventType: string,\n listener: Function,\n context: Object | null | undefined\n ): EmitterSubscription {\n return this._subscriber.addSubscription(\n eventType,\n new EmitterSubscription(this, this._subscriber, listener, context)\n ) as EmitterSubscription;\n }\n\n /**\n * Removes all of the registered listeners, including those registered as\n * listener maps.\n *\n * @param {?string} eventType - Optional name of the event whose registered\n * listeners to remove\n */\n removeAllListeners(eventType: string | undefined | null) {\n this._subscriber.removeAllSubscriptions(eventType);\n }\n\n /**\n * Removes a specific subscription. Called by the `remove()` method of the\n * subscription itself to ensure any necessary cleanup is performed.\n */\n removeSubscription(subscription: EmitterSubscription) {\n if (subscription.emitter !== this) {\n console.warn('Subscription does not belong to this emitter.'); // TODO: use HMSLogger here\n return;\n }\n\n this._subscriber.removeSubscription(subscription);\n }\n\n /**\n * Returns the number of listeners that are currently registered for the given\n * event.\n *\n * @param {string} eventType - Name of the event to query\n * @returns {number}\n */\n listenerCount(eventType: string): number {\n const subscriptions = this._subscriber.getSubscriptionsForType(eventType);\n return subscriptions\n ? // We filter out missing entries because the array is sparse.\n // \"callbackfn is called only for elements of the array which actually\n // exist; it is not called for missing elements of the array.\"\n // https://www.ecma-international.org/ecma-262/9.0/index.html#sec-array.prototype.filter\n subscriptions.filter(sparseFilterPredicate).length\n : 0;\n }\n\n /**\n * Emits an event of the given type with the given data. All handlers of that\n * particular type will be notified.\n *\n * @param {string} eventType - Name of the event to emit\n * @param {...*} Arbitrary arguments to be passed to each registered listener\n *\n * @example\n * emitter.addListener('someEvent', function(message) {\n * console.log(message);\n * });\n *\n * emitter.emit('someEvent', 'abc'); // logs 'abc'\n */\n emit(eventType: string, ...args: any[]) {\n const subscriptions = this._subscriber.getSubscriptionsForType(\n eventType\n ) as EmitterSubscription[] | null | undefined;\n if (subscriptions) {\n for (let i = 0, l = subscriptions.length; i < l; i++) {\n const subscription = subscriptions[i];\n\n // The subscription may have been removed during this event loop.\n if (subscription && subscription.listener) {\n subscription.listener.apply(subscription.context, args);\n }\n }\n }\n }\n\n /**\n * Removes the given listener for event of specific type.\n *\n * @param {string} eventType - Name of the event to emit\n * @param {function} listener - Function to invoke when the specified event is\n * emitted\n *\n * @example\n * emitter.removeListener('someEvent', function(message) {\n * console.log(message);\n * }); // removes the listener if already registered\n *\n */\n removeListener(eventType: string, listener: Function) {\n const subscriptions = this._subscriber.getSubscriptionsForType(\n eventType\n ) as EmitterSubscription[] | null | undefined;\n if (subscriptions) {\n for (let i = 0, l = subscriptions.length; i < l; i++) {\n const subscription = subscriptions[i];\n\n // The subscription may have been removed during this event loop.\n // its listener matches the listener in method parameters\n if (subscription && subscription.listener === listener) {\n subscription.remove();\n }\n }\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,mBAAmB,QAAQ,wBAAwB;AAC5D,SAASC,uBAAuB,QAAQ,4BAA4B;AAEpE,MAAMC,qBAAqB,GAAGA,CAAA,KAAM,IAAI;AAExC,SAASF,mBAAmB,QAAQ,wBAAwB;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,YAAY,CAAC;EAGxB;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,UAA2C,EAAE;IAAAC,eAAA;IACvD,IAAI,CAACC,WAAW,GAAGF,UAAU,IAAI,IAAIJ,uBAAuB,EAAE;EAChE;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEO,WAAWA,CACTC,SAAiB,EACjBC,QAAkB,EAClBC,OAAkC,EACb;IACrB,OAAO,IAAI,CAACJ,WAAW,CAACK,eAAe,CACrCH,SAAS,EACT,IAAIT,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAACO,WAAW,EAAEG,QAAQ,EAAEC,OAAO,CAAC,CACnE;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEE,kBAAkBA,CAACJ,SAAoC,EAAE;IACvD,IAAI,CAACF,WAAW,CAACO,sBAAsB,CAACL,SAAS,CAAC;EACpD;;EAEA;AACF;AACA;AACA;EACEM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EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,cAAcA,CAACzB,SAAiB,EAAEC,QAAkB,EAAE;IACpD,MAAMW,aAAa,GAAG,IAAI,CAACd,WAAW,CAACe,uBAAuB,CAC5Db,SAAS,CACkC;IAC7C,IAAIY,aAAa,EAAE;MACjB,KAAK,IAAIU,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAGX,aAAa,CAACG,MAAM,EAAEO,CAAC,GAAGC,CAAC,EAAED,CAAC,EAAE,EAAE;QACpD,MAAMf,YAAY,GAAGK,aAAa,CAACU,CAAC,CAAC;;QAErC;QACA;QACA,IAAIf,YAAY,IAAIA,YAAY,CAACN,QAAQ,KAAKA,QAAQ,EAAE;UACtDM,YAAY,CAACmB,MAAM,EAAE;QACvB;MACF;IACF;EACF;AACF"}
@@ -0,0 +1,39 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import { EventSubscription } from './_EventSubscription';
5
+ /**
6
+ * EmitterSubscription represents a subscription with listener and context data.
7
+ */
8
+ export class EmitterSubscription extends EventSubscription {
9
+ /**
10
+ * @param {EventEmitter} emitter - The event emitter that registered this
11
+ * subscription
12
+ * @param {EventSubscriptionVendor} subscriber - The subscriber that controls
13
+ * this subscription
14
+ * @param {function} listener - Function to invoke when the specified event is
15
+ * emitted
16
+ * @param {*} context - Optional context object to use when invoking the
17
+ * listener
18
+ */
19
+ constructor(emitter, subscriber, listener, context) {
20
+ super(subscriber);
21
+ _defineProperty(this, "emitter", void 0);
22
+ _defineProperty(this, "listener", void 0);
23
+ _defineProperty(this, "context", void 0);
24
+ this.emitter = emitter;
25
+ this.listener = listener;
26
+ this.context = context;
27
+ }
28
+
29
+ /**
30
+ * Removes this subscription from the emitter that registered it.
31
+ * Note: we're overriding the `remove()` method of EventSubscription here
32
+ * but deliberately not calling `super.remove()` as the responsibility
33
+ * for removing the subscription lies with the EventEmitter.
34
+ */
35
+ remove() {
36
+ this.emitter.removeSubscription(this);
37
+ }
38
+ }
39
+ //# sourceMappingURL=_EmitterSubscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EventSubscription","EmitterSubscription","constructor","emitter","subscriber","listener","context","_defineProperty","remove","removeSubscription"],"sources":["_EmitterSubscription.ts"],"sourcesContent":["import { EventSubscription } from './_EventSubscription';\nimport type { EventEmitter } from './EventEmitter';\nimport type { EventSubscriptionVendor } from './_EventSubscriptionVendor';\n\n/**\n * EmitterSubscription represents a subscription with listener and context data.\n */\nexport class EmitterSubscription extends EventSubscription {\n emitter: EventEmitter;\n listener: Function;\n context: Object | null | undefined;\n\n /**\n * @param {EventEmitter} emitter - The event emitter that registered this\n * subscription\n * @param {EventSubscriptionVendor} subscriber - The subscriber that controls\n * this subscription\n * @param {function} listener - Function to invoke when the specified event is\n * emitted\n * @param {*} context - Optional context object to use when invoking the\n * listener\n */\n constructor(\n emitter: EventEmitter,\n subscriber: EventSubscriptionVendor,\n listener: Function,\n context: Object | undefined | null\n ) {\n super(subscriber);\n this.emitter = emitter;\n this.listener = listener;\n this.context = context;\n }\n\n /**\n * Removes this subscription from the emitter that registered it.\n * Note: we're overriding the `remove()` method of EventSubscription here\n * but deliberately not calling `super.remove()` as the responsibility\n * for removing the subscription lies with the EventEmitter.\n */\n remove() {\n this.emitter.removeSubscription(this);\n }\n}\n"],"mappings":";;;AAAA,SAASA,iBAAiB,QAAQ,sBAAsB;AAIxD;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,SAASD,iBAAiB,CAAC;EAKzD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,WAAWA,CACTC,OAAqB,EACrBC,UAAmC,EACnCC,QAAkB,EAClBC,OAAkC,EAClC;IACA,KAAK,CAACF,UAAU,CAAC;IAACG,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAClB,IAAI,CAACJ,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACE,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,OAAO,GAAGA,OAAO;EACxB;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEE,MAAMA,CAAA,EAAG;IACP,IAAI,CAACL,OAAO,CAACM,kBAAkB,CAAC,IAAI,CAAC;EACvC;AACF"}
@@ -0,0 +1,29 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ /**
5
+ * EventSubscription represents a subscription to a particular event. It can
6
+ * remove its own subscription.
7
+ */
8
+ export class EventSubscription {
9
+ /**
10
+ * @param {EventSubscriptionVendor} subscriber the subscriber that controls
11
+ * this subscription.
12
+ */
13
+ constructor(subscriber) {
14
+ // @ts-ignore this value is assigned after creating instance of class
15
+ _defineProperty(this, "eventType", void 0);
16
+ // @ts-ignore this value is assigned after creating instance of class
17
+ _defineProperty(this, "key", void 0);
18
+ _defineProperty(this, "subscriber", void 0);
19
+ this.subscriber = subscriber;
20
+ }
21
+
22
+ /**
23
+ * Removes this subscription from the subscriber that controls it.
24
+ */
25
+ remove() {
26
+ this.subscriber.removeSubscription(this);
27
+ }
28
+ }
29
+ //# sourceMappingURL=_EventSubscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EventSubscription","constructor","subscriber","_defineProperty","remove","removeSubscription"],"sources":["_EventSubscription.ts"],"sourcesContent":["import type { EventSubscriptionVendor } from './_EventSubscriptionVendor';\n\n/**\n * EventSubscription represents a subscription to a particular event. It can\n * remove its own subscription.\n */\nexport class EventSubscription {\n // @ts-ignore this value is assigned after creating instance of class\n eventType: string;\n // @ts-ignore this value is assigned after creating instance of class\n key: number;\n subscriber: EventSubscriptionVendor;\n\n /**\n * @param {EventSubscriptionVendor} subscriber the subscriber that controls\n * this subscription.\n */\n constructor(subscriber: EventSubscriptionVendor) {\n this.subscriber = subscriber;\n }\n\n /**\n * Removes this subscription from the subscriber that controls it.\n */\n remove() {\n this.subscriber.removeSubscription(this);\n }\n}\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,CAAC;EAO7B;AACF;AACA;AACA;EACEC,WAAWA,CAACC,UAAmC,EAAE;IAVjD;IAAAC,eAAA;IAEA;IAAAA,eAAA;IAAAA,eAAA;IASE,IAAI,CAACD,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;EACEE,MAAMA,CAAA,EAAG;IACP,IAAI,CAACF,UAAU,CAACG,kBAAkB,CAAC,IAAI,CAAC;EAC1C;AACF"}
@@ -0,0 +1,83 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ /**
5
+ * EventSubscriptionVendor stores a set of EventSubscriptions that are
6
+ * subscribed to a particular event type.
7
+ */
8
+ export class EventSubscriptionVendor {
9
+ constructor() {
10
+ _defineProperty(this, "_subscriptionsForType", void 0);
11
+ _defineProperty(this, "_currentSubscription", void 0);
12
+ this._subscriptionsForType = {};
13
+ this._currentSubscription = null;
14
+ }
15
+
16
+ /**
17
+ * Adds a subscription keyed by an event type.
18
+ *
19
+ * @param {string} eventType
20
+ * @param {EventSubscription} subscription
21
+ */
22
+ addSubscription(eventType, subscription) {
23
+ if (subscription.subscriber !== this) {
24
+ console.warn('The subscriber of the subscription is incorrectly set.'); // TODO: throw error or use logger?
25
+ }
26
+
27
+ if (!this._subscriptionsForType[eventType]) {
28
+ this._subscriptionsForType[eventType] = [];
29
+ }
30
+ const eventSubscriptions = this._subscriptionsForType[eventType];
31
+ const key = eventSubscriptions.length;
32
+ eventSubscriptions.push(subscription);
33
+ subscription.eventType = eventType;
34
+ subscription.key = key;
35
+ return subscription;
36
+ }
37
+
38
+ /**
39
+ * Removes a bulk set of the subscriptions.
40
+ *
41
+ * @param {?string} eventType - Optional name of the event type whose
42
+ * registered supscriptions to remove, if null or undefined remove all subscriptions.
43
+ */
44
+ removeAllSubscriptions(eventType) {
45
+ if (eventType === undefined || eventType === null) {
46
+ this._subscriptionsForType = {};
47
+ } else {
48
+ delete this._subscriptionsForType[eventType];
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Removes a specific subscription. Instead of calling this function, call
54
+ * `subscription.remove()` directly.
55
+ *
56
+ * @param {object} subscription
57
+ */
58
+ removeSubscription(subscription) {
59
+ const eventType = subscription.eventType;
60
+ const key = subscription.key;
61
+ const subscriptionsForType = this._subscriptionsForType[eventType];
62
+ if (subscriptionsForType) {
63
+ delete subscriptionsForType[key];
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Returns the array of subscriptions that are currently registered for the
69
+ * given event type.
70
+ *
71
+ * Note: This array can be potentially sparse as subscriptions are deleted
72
+ * from it when they are removed.
73
+ *
74
+ * TODO: This returns a nullable array. wat?
75
+ *
76
+ * @param {string} eventType
77
+ * @returns {?array}
78
+ */
79
+ getSubscriptionsForType(eventType) {
80
+ return this._subscriptionsForType[eventType];
81
+ }
82
+ }
83
+ //# sourceMappingURL=_EventSubscriptionVendor.js.map