x4js 1.4.2

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 (176) hide show
  1. package/lib/application.d.ts +95 -0
  2. package/lib/application.js +137 -0
  3. package/lib/base64.d.ts +31 -0
  4. package/lib/base64.js +135 -0
  5. package/lib/base_component.d.ts +64 -0
  6. package/lib/base_component.js +77 -0
  7. package/lib/button.d.ts +145 -0
  8. package/lib/button.js +235 -0
  9. package/lib/calendar.d.ts +77 -0
  10. package/lib/calendar.js +236 -0
  11. package/lib/canvas.d.ts +88 -0
  12. package/lib/canvas.js +354 -0
  13. package/lib/cardview.d.ts +83 -0
  14. package/lib/cardview.js +152 -0
  15. package/lib/checkbox.d.ts +72 -0
  16. package/lib/checkbox.js +126 -0
  17. package/lib/color.d.ts +144 -0
  18. package/lib/color.js +584 -0
  19. package/lib/colorpicker.d.ts +98 -0
  20. package/lib/colorpicker.js +1457 -0
  21. package/lib/combobox.d.ts +97 -0
  22. package/lib/combobox.js +246 -0
  23. package/lib/component.d.ts +572 -0
  24. package/lib/component.js +1712 -0
  25. package/lib/datastore.d.ts +392 -0
  26. package/lib/datastore.js +986 -0
  27. package/lib/dialog.d.ts +171 -0
  28. package/lib/dialog.js +468 -0
  29. package/lib/dom_events.d.ts +284 -0
  30. package/lib/dom_events.js +13 -0
  31. package/lib/drag_manager.d.ts +26 -0
  32. package/lib/drag_manager.js +118 -0
  33. package/lib/drawtext.d.ts +43 -0
  34. package/lib/drawtext.js +261 -0
  35. package/lib/fileupload.d.ts +60 -0
  36. package/lib/fileupload.js +158 -0
  37. package/lib/form.d.ts +122 -0
  38. package/lib/form.js +293 -0
  39. package/lib/formatters.d.ts +31 -0
  40. package/lib/formatters.js +75 -0
  41. package/lib/gridview.d.ts +171 -0
  42. package/lib/gridview.js +786 -0
  43. package/lib/hosts/host.d.ts +44 -0
  44. package/lib/hosts/host.js +69 -0
  45. package/lib/i18n.d.ts +67 -0
  46. package/lib/i18n.js +169 -0
  47. package/lib/icon.d.ts +56 -0
  48. package/lib/icon.js +173 -0
  49. package/lib/image.d.ts +51 -0
  50. package/lib/image.js +149 -0
  51. package/lib/index.js +1 -0
  52. package/lib/input.d.ts +86 -0
  53. package/lib/input.js +172 -0
  54. package/lib/label.d.ts +54 -0
  55. package/lib/label.js +86 -0
  56. package/lib/layout.d.ts +77 -0
  57. package/lib/layout.js +261 -0
  58. package/lib/link.d.ts +46 -0
  59. package/lib/link.js +55 -0
  60. package/lib/listview.d.ts +173 -0
  61. package/lib/listview.js +532 -0
  62. package/lib/md5.d.ts +56 -0
  63. package/lib/md5.js +397 -0
  64. package/lib/menu.d.ts +122 -0
  65. package/lib/menu.js +276 -0
  66. package/lib/messagebox.d.ts +64 -0
  67. package/lib/messagebox.js +141 -0
  68. package/lib/panel.d.ts +42 -0
  69. package/lib/panel.js +61 -0
  70. package/lib/popup.d.ts +71 -0
  71. package/lib/popup.js +373 -0
  72. package/lib/property_editor.d.ts +67 -0
  73. package/lib/property_editor.js +247 -0
  74. package/lib/radiobtn.d.ts +68 -0
  75. package/lib/radiobtn.js +131 -0
  76. package/lib/rating.d.ts +49 -0
  77. package/lib/rating.js +93 -0
  78. package/lib/request.d.ts +48 -0
  79. package/lib/request.js +220 -0
  80. package/lib/router.d.ts +13 -0
  81. package/lib/router.js +27 -0
  82. package/lib/settings.d.ts +33 -0
  83. package/lib/settings.js +63 -0
  84. package/lib/sidebarview.d.ts +44 -0
  85. package/lib/sidebarview.js +73 -0
  86. package/lib/smartedit.d.ts +103 -0
  87. package/lib/smartedit.js +381 -0
  88. package/lib/spreadsheet.d.ts +214 -0
  89. package/lib/spreadsheet.js +1073 -0
  90. package/lib/styles.d.ts +81 -0
  91. package/lib/styles.js +262 -0
  92. package/lib/svgcomponent.d.ts +165 -0
  93. package/lib/svgcomponent.js +350 -0
  94. package/lib/tabbar.d.ts +41 -0
  95. package/lib/tabbar.js +66 -0
  96. package/lib/tabview.d.ts +45 -0
  97. package/lib/tabview.js +79 -0
  98. package/lib/textarea.d.ts +59 -0
  99. package/lib/textarea.js +119 -0
  100. package/lib/textedit.d.ts +118 -0
  101. package/lib/textedit.js +406 -0
  102. package/lib/texthiliter.d.ts +56 -0
  103. package/lib/texthiliter.js +219 -0
  104. package/lib/toaster.d.ts +38 -0
  105. package/lib/toaster.js +58 -0
  106. package/lib/tools.d.ts +382 -0
  107. package/lib/tools.js +1096 -0
  108. package/lib/tooltips.d.ts +42 -0
  109. package/lib/tooltips.js +148 -0
  110. package/lib/treeview.d.ts +128 -0
  111. package/lib/treeview.js +490 -0
  112. package/lib/x4_events.d.ts +253 -0
  113. package/lib/x4_events.js +363 -0
  114. package/package.json +21 -0
  115. package/src/README.md +2 -0
  116. package/src/application.ts +191 -0
  117. package/src/base64.ts +162 -0
  118. package/src/base_component.ts +118 -0
  119. package/src/button.ts +327 -0
  120. package/src/calendar.ts +312 -0
  121. package/src/canvas.ts +501 -0
  122. package/src/cardview.ts +220 -0
  123. package/src/checkbox.ts +178 -0
  124. package/src/color.ts +748 -0
  125. package/src/colorpicker.ts +1618 -0
  126. package/src/combobox.ts +348 -0
  127. package/src/component.ts +2330 -0
  128. package/src/datastore.ts +1318 -0
  129. package/src/dialog.ts +631 -0
  130. package/src/dom_events.ts +297 -0
  131. package/src/drag_manager.ts +168 -0
  132. package/src/drawtext.ts +342 -0
  133. package/src/fileupload.ts +208 -0
  134. package/src/form.ts +362 -0
  135. package/src/formatters.ts +96 -0
  136. package/src/gridview.ts +1051 -0
  137. package/src/hosts/electron.ts +161 -0
  138. package/src/hosts/host.ts +100 -0
  139. package/src/hosts/nwjs.ts +141 -0
  140. package/src/hosts/nwjs_types.ts +339 -0
  141. package/src/i18n.ts +205 -0
  142. package/src/icon.ts +237 -0
  143. package/src/image.ts +198 -0
  144. package/src/input.ts +236 -0
  145. package/src/label.ts +124 -0
  146. package/src/layout.ts +366 -0
  147. package/src/link.ts +82 -0
  148. package/src/listview.ts +749 -0
  149. package/src/md5.ts +432 -0
  150. package/src/menu.ts +394 -0
  151. package/src/messagebox.ts +199 -0
  152. package/src/panel.ts +81 -0
  153. package/src/popup.ts +488 -0
  154. package/src/property_editor.ts +333 -0
  155. package/src/radiobtn.ts +190 -0
  156. package/src/rating.ts +131 -0
  157. package/src/request.ts +296 -0
  158. package/src/router.ts +43 -0
  159. package/src/settings.ts +75 -0
  160. package/src/sidebarview.ts +97 -0
  161. package/src/smartedit.ts +532 -0
  162. package/src/spreadsheet.ts +1423 -0
  163. package/src/styles.ts +332 -0
  164. package/src/svgcomponent.ts +440 -0
  165. package/src/tabbar.ts +105 -0
  166. package/src/tabview.ts +106 -0
  167. package/src/textarea.ts +183 -0
  168. package/src/textedit.ts +535 -0
  169. package/src/texthiliter.ts +284 -0
  170. package/src/toaster.ts +76 -0
  171. package/src/tools.ts +1391 -0
  172. package/src/tooltips.ts +185 -0
  173. package/src/treeview.ts +670 -0
  174. package/src/x4.less +1940 -0
  175. package/src/x4_events.ts +558 -0
  176. package/tsconfig.json +14 -0
@@ -0,0 +1,558 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file observable.ts
9
+ * @author Etienne Cochard
10
+ * @license
11
+ * Copyright (c) 2019-2021 R-libre ingenierie
12
+ *
13
+ * This program is free software; you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License as published by
15
+ * the Free Software Foundation; either version 3 of the License, or
16
+ * (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+ **/
25
+
26
+ // default stopPropagation implementation for Events
27
+ const stopPropagation = function () {
28
+ this.propagationStopped = true;
29
+ }
30
+
31
+ // default preventDefault implementation for Events
32
+ const preventDefault = function () {
33
+ this.defaultPrevented = true;
34
+ }
35
+
36
+ // default callback type for events
37
+ export type EventCallback<T extends BasicEvent = BasicEvent> = (event: T) => any;
38
+ export interface EventDisposer {
39
+ dispose( ) : void;
40
+ };
41
+
42
+
43
+ /**
44
+ * Basic event
45
+ * name like that to avoid conflict with Browsers Event class.
46
+ */
47
+
48
+ export interface BasicEvent {
49
+ readonly type?: string; // type of the event 'click', 'change', ...
50
+ readonly source?: unknown; // object that fires the event
51
+ readonly context?: any; // contextual data, left to the user
52
+
53
+ propagationStopped?: boolean; // if true, do not propagate the event
54
+ defaultPrevented?: boolean; // if true, do not call default handler (if any)
55
+
56
+ stopPropagation?(): void; // stop the propagation
57
+ preventDefault?(): void; // prevent the default handler
58
+ }
59
+
60
+ /**
61
+ * BasicEvent Builder
62
+ * this function is responsable of BasicEvent creation
63
+ * ie. is equivalent of new BasicEvent( xxx );
64
+ * @param params
65
+ * @returns BasicEvent
66
+ */
67
+
68
+ export function BasicEvent<T extends BasicEvent = BasicEvent>(params: any): T {
69
+ return {
70
+ stopPropagation,
71
+ preventDefault,
72
+ ...params,
73
+ } as T;
74
+ }
75
+
76
+ /**
77
+ * Click Event
78
+ * click event do not have any additional parameters
79
+ */
80
+
81
+ export interface EvClick extends BasicEvent {
82
+ }
83
+
84
+ export function EvClick( context = null ) {
85
+ return BasicEvent<EvClick>({ context });
86
+ }
87
+
88
+
89
+ /**
90
+ * Change Event
91
+ * value is the the element value
92
+ */
93
+
94
+ export interface EvChange extends BasicEvent {
95
+ readonly value: any;
96
+ }
97
+
98
+ export function EvChange(value: unknown, context = null ) {
99
+ return BasicEvent<EvChange>({ value, context });
100
+ }
101
+
102
+ /**
103
+ * Selection Event
104
+ * value is the new selection or null
105
+ */
106
+
107
+ export interface EvSelectionChange extends BasicEvent {
108
+ readonly selection: unknown;
109
+ }
110
+
111
+ export function EvSelectionChange( selection: unknown, context = null ) {
112
+ return BasicEvent<EvSelectionChange>( { selection, context } );
113
+ }
114
+
115
+ /**
116
+ * ContextMenu Event
117
+ */
118
+
119
+ export interface EvContextMenu extends BasicEvent {
120
+ uievent: UIEvent; // UI event that fire this event
121
+ }
122
+
123
+ export function EvContextMenu( uievent: UIEvent, context = null ) {
124
+ return BasicEvent<EvContextMenu>( { uievent, context } );
125
+ }
126
+
127
+ /**
128
+ * Timer Event
129
+ * @see startTimer, stopTimer
130
+ */
131
+
132
+ export interface EvTimer extends BasicEvent {
133
+ timer: string;
134
+ time: number;
135
+ }
136
+
137
+ export function EvTimer( timer: string, time = 0, context = null ) {
138
+ return BasicEvent<EvTimer>( { timer, time, context });
139
+ }
140
+
141
+ /**
142
+ * Simple message
143
+ */
144
+
145
+ export interface EvMessage extends BasicEvent {
146
+ readonly msg: string;
147
+ readonly params?: any;
148
+ }
149
+
150
+ export function EvMessage( msg: string, params?: unknown, source?: unknown ) {
151
+ return BasicEvent<EvMessage>({msg,params,source});
152
+ }
153
+
154
+ /**
155
+ * Drag/Drop event
156
+ */
157
+
158
+ export interface EvDrag extends BasicEvent {
159
+ element: unknown;
160
+ data: any;
161
+ }
162
+
163
+ export function EvDrag(element: unknown, data: any, ctx: any ) {
164
+ return BasicEvent<EvDrag>({ element, data, context: ctx });
165
+ }
166
+
167
+
168
+ /**
169
+ * this Base interface is used to describe available events & their types
170
+ *
171
+ * you can implement your own event mapping:
172
+ * @example
173
+ * ```ts
174
+ * interface MyEventMap extends EventMap {
175
+ * click: EvClick,
176
+ * 'custom-message': Event,
177
+ * [key: string]: Event,
178
+ * }
179
+ * ```
180
+ */
181
+
182
+ export interface EventMap {
183
+ }
184
+
185
+ /**
186
+ * basic event types, in general the type is builded from the eventMap
187
+ * this is very usefull for editor completion
188
+ * @example
189
+ * ```ts
190
+ * type MyEventType = MapEvents<MyEventMap>;
191
+ * ```
192
+ */
193
+ export interface EventTypes {
194
+ }
195
+
196
+ /**
197
+ * convert an EventMap to a EventType
198
+ */
199
+
200
+ export type MapEvents<Type> = {
201
+ [Property in keyof Type]?: (ev: Type[Property]) => any;
202
+ };
203
+
204
+
205
+ /**
206
+ * Event emitter class
207
+ * this class allow you to emit and handle events
208
+ *
209
+ * @example:
210
+ * ```ts
211
+ *
212
+ * interface EvDoIt extends BasicEvent {
213
+ * param: unknown;
214
+ * }
215
+ *
216
+ * function EvDoIt( e: EvDoIt ) : EvDoIt {
217
+ * return BasicEvent<EvDoIt>( e );
218
+ * }
219
+ *
220
+ * interface TestEventMap extends EventMap {
221
+ * doit: EvDoIt;
222
+ * }
223
+ *
224
+ * let ee = new EventSource<TestEventMap>(null);
225
+ * ee.listen({
226
+ * doit: (e) => {
227
+ * console.log(e);
228
+ * e.preventDefault();
229
+ * },
230
+ * });
231
+ *
232
+ * ee.defaults({
233
+ * doit: (e) => {
234
+ * console.log('default handler for ', e.type, e.selection);
235
+ * },
236
+ * })
237
+ *
238
+ * ee.on('doit', (e) => {
239
+ * debugger;
240
+ * })
241
+ *
242
+ * const ev = EvDoIt({ param: 10 });
243
+ * ee.emit('change', ev);
244
+ * if (ev.defaultPrevented) {
245
+ * console.log('prevented');
246
+ * }
247
+ * ```
248
+ */
249
+
250
+ export class EventSource<Q extends EventMap, T extends EventTypes = MapEvents<Q>> {
251
+
252
+ private m_source: unknown;
253
+ private m_eventRegistry: Map<string, EventCallback[]>;
254
+ private m_defaultHandlers: Map<string, EventCallback[]>;
255
+
256
+ constructor(source: unknown = null) {
257
+ this.m_source = source ?? this;
258
+ }
259
+
260
+ /**
261
+ * emit an event
262
+ * you can stop propagation of event or prevent default
263
+ * @param eventName - name of event to emit
264
+ * @param event - event data
265
+ */
266
+
267
+ emit<K extends keyof Q>(type: K, event?: Q[K]) {
268
+ this._emit(type as string, event);
269
+ }
270
+
271
+ _emit(eventName: string, e: BasicEvent): void {
272
+ let listeners = this.m_eventRegistry?.get(eventName);
273
+ const defaultHandler = this.m_defaultHandlers?.get(eventName);
274
+
275
+ if (!e) {
276
+ e = {};
277
+ }
278
+
279
+ if (!e.source) {
280
+ (e as any).source = this.m_source;
281
+ }
282
+
283
+ if (!e.type) {
284
+ (e as any).type = eventName;
285
+ }
286
+
287
+ if (listeners && listeners.length) {
288
+
289
+ if (!e.preventDefault) {
290
+ e.preventDefault = preventDefault;
291
+ }
292
+
293
+ if (!e.stopPropagation) {
294
+ e.stopPropagation = stopPropagation;
295
+ }
296
+
297
+ // small optimisation
298
+ if (listeners.length == 1) {
299
+ listeners[0](e);
300
+ }
301
+ else {
302
+ const temp = listeners.slice();
303
+ for (let i = 0, n = temp.length; i < n; i++) {
304
+ temp[i](e);
305
+ if (e.propagationStopped) {
306
+ break;
307
+ }
308
+ }
309
+ }
310
+ }
311
+
312
+ if (defaultHandler && defaultHandler.length && !e.defaultPrevented) {
313
+ return defaultHandler[0](e);
314
+ }
315
+ }
316
+
317
+ /**
318
+ * signal en event
319
+ * signaled event are notification : no way to prevent default not stop propagation
320
+ * @param eventName name of event to signal
321
+ * @param event event data
322
+ */
323
+
324
+ signal<K extends keyof Q>(type: K, event: Q[K], delay=-1) {
325
+ this._signal(type as string, event,delay);
326
+ }
327
+
328
+ _signal(eventName: string, e: BasicEvent,delay=-1): void {
329
+
330
+ if (!this.m_eventRegistry) {
331
+ return;
332
+ }
333
+
334
+ const listeners = this.m_eventRegistry.get(eventName);
335
+ if (!listeners || !listeners.length ) {
336
+ return;
337
+ }
338
+
339
+ if (!e) {
340
+ e = {};
341
+ }
342
+
343
+ if (!e.type) {
344
+ (e as any).type = eventName;
345
+ }
346
+
347
+ if (!e.source) {
348
+ (e as any).source = this.m_source;
349
+ }
350
+
351
+ e.preventDefault = e.stopPropagation = () => {
352
+ console.error('this event cannot be stopped not default prevented');
353
+ }
354
+
355
+ // small optimisation
356
+ if (listeners.length == 1 && delay==-1 ) {
357
+ listeners[0](e);
358
+ }
359
+ else {
360
+ const temp = listeners.slice();
361
+
362
+ const call = ( ) => {
363
+ for (let i = 0, n = temp.length; i < n; i++) {
364
+ temp[i](e);
365
+ }
366
+ }
367
+
368
+ if( delay==-1 ) {
369
+ call( );
370
+ }
371
+ else {
372
+ setTimeout( call, delay );
373
+ }
374
+ }
375
+ }
376
+
377
+ /**
378
+ * handle an event one time
379
+ * @param eventName - event name to handle
380
+ * @param callback - callback to call when event is signaled
381
+ * @returns Promise if callback is null
382
+ *
383
+ * take care with that because if the event is never fired and you await it,
384
+ * the system may overflow
385
+ */
386
+
387
+ once<K extends keyof Q>(type: K, callback: (ev: Q[K]) => any) {
388
+ this._once(type as string, callback);
389
+ }
390
+
391
+ _once(eventName: string, callback: EventCallback) {
392
+
393
+ const newCallback = ( ev ) => {
394
+ this.off(eventName, newCallback);
395
+ callback( ev );
396
+ }
397
+
398
+ this._on(eventName, newCallback);
399
+
400
+ if (!callback) {
401
+ return new Promise(function (resolve) {
402
+ callback = resolve;
403
+ });
404
+ }
405
+ }
406
+
407
+ /**
408
+ * set the event default handler
409
+ * @param eventName - name of the event
410
+ * @param callback - callback to call when the event is not handled (and preventDeault has not been called)
411
+ */
412
+
413
+ setDefaultHandler(eventName: string, callback: EventCallback): void {
414
+
415
+ let handlers = this.m_defaultHandlers;
416
+ if (!handlers) {
417
+ handlers = this.m_defaultHandlers = new Map()
418
+ }
419
+
420
+ let stack = handlers.get(eventName);
421
+ if (stack) {
422
+
423
+ // if already in the stack, remove it
424
+ const idx = stack.indexOf(callback);
425
+ if (idx != -1) {
426
+ stack.splice(idx, 1);
427
+ }
428
+
429
+ // then make it first
430
+ stack.unshift(callback);
431
+ }
432
+ else {
433
+ handlers.set(eventName, [callback]);
434
+ }
435
+ }
436
+
437
+ /**
438
+ * remove the previous default handler installed for an event
439
+ * @param eventName - event name
440
+ * @param callback - callback handler to remove (must be the same as in setDefaultHandler)
441
+ */
442
+
443
+ removeDefaultHandler(eventName: string, callback: EventCallback): void {
444
+ const handlers = this.m_defaultHandlers;
445
+ if (!handlers) {
446
+ return;
447
+ }
448
+
449
+ const stack = handlers.get(eventName);
450
+ if (stack) {
451
+ const idx = stack.indexOf(callback);
452
+ if (idx != -1) {
453
+ stack.splice(idx, 1);
454
+ }
455
+ }
456
+ }
457
+
458
+ /**
459
+ * define a set of listeners in one call
460
+ * @param events
461
+ */
462
+
463
+ listen(events: T) {
464
+ for (let n in events) {
465
+ this._on(n, events[n] as unknown as EventCallback);
466
+ }
467
+ }
468
+
469
+ /**
470
+ * define a set of default handlers in one call
471
+ * @param events
472
+ */
473
+
474
+ defaults(events: T) {
475
+ for (let n in events) {
476
+ this.setDefaultHandler(n, events[n] as unknown as EventCallback);
477
+ }
478
+ }
479
+
480
+ /**
481
+ * listen for an event
482
+ * @param eventName - event name to listen on
483
+ * @param callback - callback to call
484
+ * @param capturing - if true, capture event before other registred event handlers
485
+ */
486
+
487
+ on<K extends keyof Q>(type: K, callback: (ev: Q[K]) => any) : EventDisposer {
488
+ return this._on(type as string, callback);
489
+ }
490
+
491
+ _on(eventName: string, callback: EventCallback, capturing = false): EventDisposer {
492
+
493
+ if (!this.m_eventRegistry) {
494
+ this.m_eventRegistry = new Map();
495
+ }
496
+
497
+ let listeners = this.m_eventRegistry.get(eventName);
498
+ if (!listeners) {
499
+ listeners = [];
500
+ this.m_eventRegistry.set(eventName, listeners);
501
+ }
502
+
503
+ if (listeners.indexOf(callback) == -1) {
504
+ if (capturing) {
505
+ listeners.unshift(callback);
506
+ }
507
+ else {
508
+ listeners.push(callback);
509
+ }
510
+ }
511
+
512
+ return {
513
+ dispose: ( ) => { this.off( eventName, callback ); }
514
+ }
515
+ }
516
+
517
+ /**
518
+ * stop listening to an event
519
+ * @param eventName - event name
520
+ * @param callback - callback to remove (must be the same as in on )
521
+ */
522
+
523
+ off(eventName: string, callback: EventCallback ): void {
524
+ if (!this.m_eventRegistry) {
525
+ return;
526
+ }
527
+
528
+ let listeners = this.m_eventRegistry.get(eventName);
529
+ if (!listeners) {
530
+ return;
531
+ }
532
+
533
+ const idx = listeners.indexOf(callback);
534
+ if (idx !== -1) {
535
+ listeners.splice(idx, 1);
536
+ }
537
+ }
538
+
539
+ /**
540
+ * remove all listeners for an event
541
+ * @param eventName - event name
542
+ */
543
+
544
+ removeAllListeners(eventName: string | null): void {
545
+ if (!eventName) {
546
+ this.m_eventRegistry = this.m_defaultHandlers = undefined;
547
+ }
548
+ else {
549
+ if (this.m_eventRegistry) {
550
+ this.m_eventRegistry[eventName] = undefined;
551
+ }
552
+
553
+ if (this.m_defaultHandlers) {
554
+ this.m_defaultHandlers[eventName] = undefined;
555
+ }
556
+ }
557
+ }
558
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "lib": [ "esnext", "dom" ],
5
+ "noImplicitAny": false,
6
+ "strictNullChecks": false,
7
+ "outDir": "./lib",
8
+ "declaration": true,
9
+ "strict": false
10
+ },
11
+ "include": [
12
+ "./src/*",
13
+ ]
14
+ }