brilliantsole 0.0.11 → 0.0.13
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/build/brilliantsole.cjs +40 -0
- package/build/brilliantsole.cjs.map +1 -1
- package/build/brilliantsole.js +40 -0
- package/build/brilliantsole.js.map +1 -1
- package/build/brilliantsole.ls.js +40 -0
- package/build/brilliantsole.ls.js.map +1 -1
- package/build/brilliantsole.min.js +1 -1
- package/build/brilliantsole.min.js.map +1 -1
- package/build/brilliantsole.module.d.ts +6 -0
- package/build/brilliantsole.module.js +40 -0
- package/build/brilliantsole.module.js.map +1 -1
- package/build/brilliantsole.module.min.d.ts +6 -0
- package/build/brilliantsole.module.min.js +1 -1
- package/build/brilliantsole.module.min.js.map +1 -1
- package/build/brilliantsole.node.module.d.ts +6 -0
- package/build/brilliantsole.node.module.js +40 -0
- package/build/brilliantsole.node.module.js.map +1 -1
- package/build/dts/Device.d.ts +2 -0
- package/build/dts/DeviceManager.d.ts +2 -0
- package/build/dts/devicePair/DevicePair.d.ts +2 -0
- package/build/dts/utils/EventDispatcher.d.ts +2 -0
- package/build/dts/utils/ObjectUtils.d.ts +1 -0
- package/build/index.d.ts +8 -0
- package/build/index.node.d.ts +8 -0
- package/package.json +1 -1
- package/src/Device.ts +6 -0
- package/src/DeviceManager.ts +6 -0
- package/src/devicePair/DevicePair.ts +6 -0
- package/src/utils/EventDispatcher.ts +26 -0
- package/src/utils/ObjectUtils.ts +22 -0
package/build/brilliantsole.js
CHANGED
|
@@ -173,6 +173,8 @@
|
|
|
173
173
|
this.listeners = {};
|
|
174
174
|
this.addEventListener = this.addEventListener.bind(this);
|
|
175
175
|
this.removeEventListener = this.removeEventListener.bind(this);
|
|
176
|
+
this.removeEventListeners = this.removeEventListeners.bind(this);
|
|
177
|
+
this.removeAllEventListeners = this.removeAllEventListeners.bind(this);
|
|
176
178
|
this.dispatchEvent = this.dispatchEvent.bind(this);
|
|
177
179
|
this.waitForEvent = this.waitForEvent.bind(this);
|
|
178
180
|
}
|
|
@@ -197,6 +199,13 @@
|
|
|
197
199
|
this.listeners[type] = [];
|
|
198
200
|
_console$v.log(`creating "${type}" listeners array`, this.listeners[type]);
|
|
199
201
|
}
|
|
202
|
+
const alreadyAdded = this.listeners[type].find((listenerObject) => {
|
|
203
|
+
return listenerObject.listener == listener && listenerObject.once == options.once;
|
|
204
|
+
});
|
|
205
|
+
if (alreadyAdded) {
|
|
206
|
+
_console$v.log("already added listener");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
200
209
|
_console$v.log(`adding "${type}" listener`, listener, options);
|
|
201
210
|
this.listeners[type].push({ listener, once: options.once });
|
|
202
211
|
_console$v.log(`currently have ${this.listeners[type].length} "${type}" listeners`);
|
|
@@ -217,6 +226,19 @@
|
|
|
217
226
|
});
|
|
218
227
|
this.updateEventListeners(type);
|
|
219
228
|
}
|
|
229
|
+
removeEventListeners(type) {
|
|
230
|
+
if (!this.isValidEventType(type)) {
|
|
231
|
+
throw new Error(`Invalid event type: ${type}`);
|
|
232
|
+
}
|
|
233
|
+
if (!this.listeners[type])
|
|
234
|
+
return;
|
|
235
|
+
_console$v.log(`removing "${type}" listeners...`);
|
|
236
|
+
this.listeners[type] = [];
|
|
237
|
+
}
|
|
238
|
+
removeAllEventListeners() {
|
|
239
|
+
_console$v.log(`removing listeners...`);
|
|
240
|
+
this.listeners = {};
|
|
241
|
+
}
|
|
220
242
|
dispatchEvent(type, message) {
|
|
221
243
|
if (!this.isValidEventType(type)) {
|
|
222
244
|
throw new Error(`Invalid event type: ${type}`);
|
|
@@ -3964,6 +3986,12 @@
|
|
|
3964
3986
|
get RemoveEventListener() {
|
|
3965
3987
|
return __classPrivateFieldGet(this, _DeviceManager_EventDispatcher, "f").removeEventListener;
|
|
3966
3988
|
}
|
|
3989
|
+
get RemoveEventListeners() {
|
|
3990
|
+
return __classPrivateFieldGet(this, _DeviceManager_EventDispatcher, "f").removeEventListeners;
|
|
3991
|
+
}
|
|
3992
|
+
get RemoveAllEventListeners() {
|
|
3993
|
+
return __classPrivateFieldGet(this, _DeviceManager_EventDispatcher, "f").removeAllEventListeners;
|
|
3994
|
+
}
|
|
3967
3995
|
}
|
|
3968
3996
|
_DeviceManager_boundDeviceEventListeners = new WeakMap(), _DeviceManager_ConnectedDevices = new WeakMap(), _DeviceManager_UseLocalStorage = new WeakMap(), _DeviceManager_DefaultLocalStorageConfiguration = new WeakMap(), _DeviceManager_LocalStorageConfiguration = new WeakMap(), _DeviceManager_LocalStorageKey = new WeakMap(), _DeviceManager_AvailableDevices = new WeakMap(), _DeviceManager_EventDispatcher = new WeakMap(), _DeviceManager_instances = new WeakSet(), _DeviceManager_onDeviceType = function _DeviceManager_onDeviceType(event) {
|
|
3969
3997
|
if (__classPrivateFieldGet(this, _DeviceManager_UseLocalStorage, "f")) {
|
|
@@ -4183,6 +4211,12 @@
|
|
|
4183
4211
|
get waitForEvent() {
|
|
4184
4212
|
return __classPrivateFieldGet(this, _Device_eventDispatcher, "f").waitForEvent;
|
|
4185
4213
|
}
|
|
4214
|
+
get removeEventListeners() {
|
|
4215
|
+
return __classPrivateFieldGet(this, _Device_eventDispatcher, "f").removeEventListeners;
|
|
4216
|
+
}
|
|
4217
|
+
get removeAllEventListeners() {
|
|
4218
|
+
return __classPrivateFieldGet(this, _Device_eventDispatcher, "f").removeAllEventListeners;
|
|
4219
|
+
}
|
|
4186
4220
|
get connectionManager() {
|
|
4187
4221
|
return __classPrivateFieldGet(this, _Device_connectionManager, "f");
|
|
4188
4222
|
}
|
|
@@ -4726,6 +4760,12 @@
|
|
|
4726
4760
|
get waitForEvent() {
|
|
4727
4761
|
return __classPrivateFieldGet(this, _DevicePair_eventDispatcher, "f").waitForEvent;
|
|
4728
4762
|
}
|
|
4763
|
+
get removeEventListeners() {
|
|
4764
|
+
return __classPrivateFieldGet(this, _DevicePair_eventDispatcher, "f").removeEventListeners;
|
|
4765
|
+
}
|
|
4766
|
+
get removeAllEventListeners() {
|
|
4767
|
+
return __classPrivateFieldGet(this, _DevicePair_eventDispatcher, "f").removeAllEventListeners;
|
|
4768
|
+
}
|
|
4729
4769
|
get left() {
|
|
4730
4770
|
return __classPrivateFieldGet(this, _DevicePair_left, "f");
|
|
4731
4771
|
}
|