native-document 1.0.133 → 1.0.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/native-document.components.min.js +106 -86
- package/package.json +1 -1
- package/src/components/BaseComponent.js +10 -1
- package/src/components/accordion/Accordion.js +2 -2
- package/src/components/alert/Alert.js +2 -2
- package/src/components/breadcrumb/BreadCrumb.js +2 -2
- package/src/components/dropdown/Dropdown.js +2 -2
- package/src/components/form/FormControl.js +3 -3
- package/src/components/layouts/HStack.js +1 -1
- package/src/components/layouts/Stack.js +1 -0
- package/src/components/layouts/VStack.js +5 -2
- package/src/components/list/List.js +3 -2
- package/src/components/list/ListGroup.js +2 -1
- package/src/components/menu/Menu.js +3 -2
- package/src/components/menu/MenuGroup.js +2 -1
- package/src/components/menu/MenuItem.js +2 -1
- package/src/components/modal/Modal.js +2 -2
- package/src/components/pagination/Pagination.js +2 -2
- package/src/components/popover/Popover.js +2 -2
- package/src/components/progress/Progress.js +2 -2
- package/src/components/slider/Slider.js +2 -2
- package/src/components/spinner/Spinner.js +2 -0
- package/src/components/splitter/Splitter.js +2 -2
- package/src/components/stepper/Stepper.js +2 -2
- package/src/components/switch/Switch.js +2 -2
- package/src/components/tabs/Tabs.js +2 -2
- package/src/components/toast/Toast.js +2 -2
- package/src/core/utils/{EventEmitter.js → HasEventEmitter.js} +5 -6
|
@@ -21,7 +21,8 @@ var NativeComponents = (function (exports) {
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
BaseComponent.extends = function(Component, ...parents) {
|
|
24
|
-
|
|
24
|
+
const MainParent = parents[0] || BaseComponent;
|
|
25
|
+
Component.prototype = Object.create(MainParent.prototype);
|
|
25
26
|
|
|
26
27
|
if(parents.length > 0) {
|
|
27
28
|
for(const parent of parents) {
|
|
@@ -31,6 +32,14 @@ var NativeComponents = (function (exports) {
|
|
|
31
32
|
Component.prototype.constructor = Component;
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
BaseComponent.use = function(Component, ...traits) {
|
|
36
|
+
if(traits.length > 0) {
|
|
37
|
+
for(const trait of traits) {
|
|
38
|
+
Object.assign(Component.prototype, trait.prototype);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
34
43
|
BaseComponent.obs = (value) => {
|
|
35
44
|
return value.__$Observable ? value : Observable(value);
|
|
36
45
|
};
|
|
@@ -79,22 +88,13 @@ var NativeComponents = (function (exports) {
|
|
|
79
88
|
return this;
|
|
80
89
|
};
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
constructor(message, context = {}) {
|
|
84
|
-
super(message);
|
|
85
|
-
this.name = 'NativeDocumentError';
|
|
86
|
-
this.context = context;
|
|
87
|
-
this.timestamp = new Date().toISOString();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function EventEmitter() {
|
|
91
|
+
function HasEventEmitter() {
|
|
92
92
|
|
|
93
93
|
this.__$events = null;
|
|
94
94
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
HasEventEmitter.prototype.on = function(eventName, callback) {
|
|
98
98
|
if(!this.__$events) {
|
|
99
99
|
this.__$events = new Map();
|
|
100
100
|
}
|
|
@@ -110,11 +110,11 @@ var NativeComponents = (function (exports) {
|
|
|
110
110
|
existingCallback.push(callback);
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
HasEventEmitter.prototype.hasListeners = function(eventName) {
|
|
114
114
|
return !!this.__$events.get(eventName);
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
HasEventEmitter.prototype.trigger = async function(eventName, ...args) {
|
|
118
118
|
const callbacks = this.__$events.get(eventName);
|
|
119
119
|
if(!callbacks) {
|
|
120
120
|
// throw new NativeDocumentError(this.constructor.name, 'Event '+eventName+' not found');
|
|
@@ -131,7 +131,7 @@ var NativeComponents = (function (exports) {
|
|
|
131
131
|
}
|
|
132
132
|
return result;
|
|
133
133
|
};
|
|
134
|
-
|
|
134
|
+
HasEventEmitter.prototype.emit = HasEventEmitter.prototype.trigger;
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
137
|
* Valid children types that can be rendered in the DOM
|
|
@@ -158,7 +158,7 @@ var NativeComponents = (function (exports) {
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
BaseComponent.extends(Accordion,
|
|
161
|
+
BaseComponent.extends(Accordion, HasEventEmitter);
|
|
162
162
|
|
|
163
163
|
Accordion.defaultTemplate = null;
|
|
164
164
|
|
|
@@ -378,6 +378,15 @@ var NativeComponents = (function (exports) {
|
|
|
378
378
|
}
|
|
379
379
|
var DebugManager$1 = DebugManager$2;
|
|
380
380
|
|
|
381
|
+
class NativeDocumentError extends Error {
|
|
382
|
+
constructor(message, context = {}) {
|
|
383
|
+
super(message);
|
|
384
|
+
this.name = 'NativeDocumentError';
|
|
385
|
+
this.context = context;
|
|
386
|
+
this.timestamp = new Date().toISOString();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
381
390
|
/**
|
|
382
391
|
*
|
|
383
392
|
* @param {ObservableItem} $observable
|
|
@@ -4614,7 +4623,7 @@ var NativeComponents = (function (exports) {
|
|
|
4614
4623
|
Alert.defaultContentTemplate = template.alertContent;
|
|
4615
4624
|
};
|
|
4616
4625
|
|
|
4617
|
-
BaseComponent.extends(Alert,
|
|
4626
|
+
BaseComponent.extends(Alert, HasEventEmitter);
|
|
4618
4627
|
|
|
4619
4628
|
/**
|
|
4620
4629
|
* Sets the variant style for the alert
|
|
@@ -5623,7 +5632,7 @@ var NativeComponents = (function (exports) {
|
|
|
5623
5632
|
};
|
|
5624
5633
|
}
|
|
5625
5634
|
|
|
5626
|
-
BaseComponent.extends(Breadcrumb,
|
|
5635
|
+
BaseComponent.extends(Breadcrumb, HasEventEmitter);
|
|
5627
5636
|
|
|
5628
5637
|
Breadcrumb.use = function(template) {};
|
|
5629
5638
|
Breadcrumb.defaultTemplate = null;
|
|
@@ -5896,7 +5905,8 @@ var NativeComponents = (function (exports) {
|
|
|
5896
5905
|
MenuGroup.defaultTemplate = template.menuGroup;
|
|
5897
5906
|
};
|
|
5898
5907
|
|
|
5899
|
-
BaseComponent.extends(MenuGroup
|
|
5908
|
+
BaseComponent.extends(MenuGroup);
|
|
5909
|
+
BaseComponent.use(MenuGroup, HasItems);
|
|
5900
5910
|
|
|
5901
5911
|
MenuGroup.prototype.data = function(data) {
|
|
5902
5912
|
this.$description.data = data;
|
|
@@ -5942,7 +5952,8 @@ var NativeComponents = (function (exports) {
|
|
|
5942
5952
|
MenuItem.defaultTemplate = template.menuItem;
|
|
5943
5953
|
};
|
|
5944
5954
|
|
|
5945
|
-
BaseComponent.extends(MenuItem
|
|
5955
|
+
BaseComponent.extends(MenuItem);
|
|
5956
|
+
BaseComponent.use(MenuItem, HasItems);
|
|
5946
5957
|
|
|
5947
5958
|
|
|
5948
5959
|
MenuItem.prototype.label = function(label) {
|
|
@@ -6040,7 +6051,8 @@ var NativeComponents = (function (exports) {
|
|
|
6040
6051
|
|
|
6041
6052
|
}
|
|
6042
6053
|
|
|
6043
|
-
BaseComponent.extends(Menu
|
|
6054
|
+
BaseComponent.extends(Menu);
|
|
6055
|
+
BaseComponent.use(Menu, HasItems, HasEventEmitter);
|
|
6044
6056
|
|
|
6045
6057
|
Menu.defaultTemplate = null;
|
|
6046
6058
|
|
|
@@ -6611,7 +6623,7 @@ var NativeComponents = (function (exports) {
|
|
|
6611
6623
|
this.$element = null;
|
|
6612
6624
|
}
|
|
6613
6625
|
|
|
6614
|
-
BaseComponent.extends(Dropdown,
|
|
6626
|
+
BaseComponent.extends(Dropdown, HasEventEmitter);
|
|
6615
6627
|
|
|
6616
6628
|
|
|
6617
6629
|
Dropdown.defaultTemplate = null;
|
|
@@ -7644,7 +7656,7 @@ var NativeComponents = (function (exports) {
|
|
|
7644
7656
|
if(!(this instanceof FormControl)) {
|
|
7645
7657
|
return new FormControl(configs);
|
|
7646
7658
|
}
|
|
7647
|
-
|
|
7659
|
+
HasEventEmitter.call(this);
|
|
7648
7660
|
|
|
7649
7661
|
this.$element = null;
|
|
7650
7662
|
this.$configs = configs;
|
|
@@ -7665,7 +7677,7 @@ var NativeComponents = (function (exports) {
|
|
|
7665
7677
|
return new FormControl(configs);
|
|
7666
7678
|
};
|
|
7667
7679
|
|
|
7668
|
-
BaseComponent.extends(FormControl,
|
|
7680
|
+
BaseComponent.extends(FormControl, HasEventEmitter);
|
|
7669
7681
|
|
|
7670
7682
|
Object.defineProperty(FormControl.prototype, 'isDirty', {
|
|
7671
7683
|
get() { return this.$isDirty; }
|
|
@@ -9350,7 +9362,8 @@ var NativeComponents = (function (exports) {
|
|
|
9350
9362
|
List.defaultTemplate = template.list;
|
|
9351
9363
|
};
|
|
9352
9364
|
|
|
9353
|
-
BaseComponent.extends(List
|
|
9365
|
+
BaseComponent.extends(List);
|
|
9366
|
+
BaseComponent.use(List, HasItems, HasEventEmitter);
|
|
9354
9367
|
|
|
9355
9368
|
List.defaultTemplate = null;
|
|
9356
9369
|
|
|
@@ -9543,7 +9556,8 @@ var NativeComponents = (function (exports) {
|
|
|
9543
9556
|
};
|
|
9544
9557
|
}
|
|
9545
9558
|
|
|
9546
|
-
BaseComponent.extends(ListGroup
|
|
9559
|
+
BaseComponent.extends(ListGroup);
|
|
9560
|
+
BaseComponent.use(ListGroup, HasItems);
|
|
9547
9561
|
|
|
9548
9562
|
ListGroup.defaultTemplate = null;
|
|
9549
9563
|
|
|
@@ -9610,7 +9624,7 @@ var NativeComponents = (function (exports) {
|
|
|
9610
9624
|
};
|
|
9611
9625
|
}
|
|
9612
9626
|
|
|
9613
|
-
BaseComponent.extends(Modal,
|
|
9627
|
+
BaseComponent.extends(Modal, HasEventEmitter);
|
|
9614
9628
|
|
|
9615
9629
|
// Theming
|
|
9616
9630
|
Modal.defaultLayout = null;
|
|
@@ -9770,7 +9784,7 @@ var NativeComponents = (function (exports) {
|
|
|
9770
9784
|
this.$element = null;
|
|
9771
9785
|
}
|
|
9772
9786
|
|
|
9773
|
-
BaseComponent.extends(Pagination,
|
|
9787
|
+
BaseComponent.extends(Pagination, HasEventEmitter);
|
|
9774
9788
|
|
|
9775
9789
|
Pagination.defaultTemplate = null;
|
|
9776
9790
|
|
|
@@ -10001,7 +10015,7 @@ var NativeComponents = (function (exports) {
|
|
|
10001
10015
|
}
|
|
10002
10016
|
}
|
|
10003
10017
|
|
|
10004
|
-
BaseComponent.extends(Popover,
|
|
10018
|
+
BaseComponent.extends(Popover, HasEventEmitter);
|
|
10005
10019
|
|
|
10006
10020
|
Popover.defaultTemplate = null;
|
|
10007
10021
|
|
|
@@ -10255,7 +10269,7 @@ var NativeComponents = (function (exports) {
|
|
|
10255
10269
|
};
|
|
10256
10270
|
}
|
|
10257
10271
|
|
|
10258
|
-
BaseComponent.extends(Progress,
|
|
10272
|
+
BaseComponent.extends(Progress, HasEventEmitter);
|
|
10259
10273
|
|
|
10260
10274
|
Progress.defaultTemplate = null;
|
|
10261
10275
|
|
|
@@ -10634,7 +10648,7 @@ var NativeComponents = (function (exports) {
|
|
|
10634
10648
|
};
|
|
10635
10649
|
}
|
|
10636
10650
|
|
|
10637
|
-
BaseComponent.extends(Slider,
|
|
10651
|
+
BaseComponent.extends(Slider, HasEventEmitter);
|
|
10638
10652
|
|
|
10639
10653
|
Slider.use = function(template) {};
|
|
10640
10654
|
Slider.defaultTemplate = null;
|
|
@@ -10783,9 +10797,9 @@ var NativeComponents = (function (exports) {
|
|
|
10783
10797
|
return this.$build();
|
|
10784
10798
|
};
|
|
10785
10799
|
|
|
10786
|
-
function Spinner
|
|
10787
|
-
if (!(this instanceof Spinner
|
|
10788
|
-
return new Spinner
|
|
10800
|
+
function Spinner(props = {}) {
|
|
10801
|
+
if (!(this instanceof Spinner)) {
|
|
10802
|
+
return new Spinner(props);
|
|
10789
10803
|
}
|
|
10790
10804
|
|
|
10791
10805
|
this.$description = {
|
|
@@ -10804,43 +10818,45 @@ var NativeComponents = (function (exports) {
|
|
|
10804
10818
|
};
|
|
10805
10819
|
}
|
|
10806
10820
|
|
|
10807
|
-
Spinner
|
|
10808
|
-
Spinner
|
|
10809
|
-
Spinner
|
|
10821
|
+
Spinner.defaultTemplate = null;
|
|
10822
|
+
Spinner.use = function(template) {
|
|
10823
|
+
Spinner.defaultTemplate = template.spinner;
|
|
10810
10824
|
};
|
|
10811
10825
|
|
|
10812
|
-
|
|
10813
|
-
|
|
10826
|
+
BaseComponent.extends(Spinner);
|
|
10827
|
+
|
|
10828
|
+
Spinner.preset = function(name, callback) {
|
|
10829
|
+
if (Spinner.prototype[name] || Spinner[name]) {
|
|
10814
10830
|
DebugManager$1.warn(`Warning: the ${name} method already exists in Spinner.`);
|
|
10815
10831
|
return;
|
|
10816
10832
|
}
|
|
10817
|
-
Spinner
|
|
10833
|
+
Spinner[name] = (props) => callback(new Spinner(props));
|
|
10818
10834
|
};
|
|
10819
10835
|
|
|
10820
|
-
Spinner
|
|
10836
|
+
Spinner.presets = function(presets) {
|
|
10821
10837
|
for (const name in presets) {
|
|
10822
|
-
Spinner
|
|
10838
|
+
Spinner.preset(name, presets[name]);
|
|
10823
10839
|
}
|
|
10824
10840
|
};
|
|
10825
10841
|
|
|
10826
|
-
Spinner
|
|
10842
|
+
Spinner.prototype.type = function(type) {
|
|
10827
10843
|
this.$description.type = type;
|
|
10828
10844
|
return this;
|
|
10829
10845
|
};
|
|
10830
10846
|
|
|
10831
|
-
Spinner
|
|
10847
|
+
Spinner.prototype.circle = function() {
|
|
10832
10848
|
return this.type('circle');
|
|
10833
10849
|
};
|
|
10834
|
-
Spinner
|
|
10850
|
+
Spinner.prototype.dots = function() {
|
|
10835
10851
|
return this.type('dots');
|
|
10836
10852
|
};
|
|
10837
|
-
Spinner
|
|
10853
|
+
Spinner.prototype.bars = function() {
|
|
10838
10854
|
return this.type('bars');
|
|
10839
10855
|
};
|
|
10840
|
-
Spinner
|
|
10856
|
+
Spinner.prototype.pulse = function() {
|
|
10841
10857
|
return this.type('pulse');
|
|
10842
10858
|
};
|
|
10843
|
-
Spinner
|
|
10859
|
+
Spinner.prototype.ring = function() {
|
|
10844
10860
|
return this.type('ring');
|
|
10845
10861
|
};
|
|
10846
10862
|
|
|
@@ -10848,79 +10864,79 @@ var NativeComponents = (function (exports) {
|
|
|
10848
10864
|
* @param {string|int} size
|
|
10849
10865
|
* @returns {Spinner}
|
|
10850
10866
|
*/
|
|
10851
|
-
Spinner
|
|
10867
|
+
Spinner.prototype.size = function(size) {
|
|
10852
10868
|
this.$description.size = size;
|
|
10853
10869
|
return this;
|
|
10854
10870
|
};
|
|
10855
|
-
Spinner
|
|
10871
|
+
Spinner.prototype.extraSmall = function() {
|
|
10856
10872
|
return this.size('extra-small');
|
|
10857
10873
|
};
|
|
10858
|
-
Spinner
|
|
10874
|
+
Spinner.prototype.small = function() {
|
|
10859
10875
|
return this.size('small');
|
|
10860
10876
|
};
|
|
10861
|
-
Spinner
|
|
10877
|
+
Spinner.prototype.medium = function() {
|
|
10862
10878
|
return this.size('medium');
|
|
10863
10879
|
};
|
|
10864
|
-
Spinner
|
|
10880
|
+
Spinner.prototype.large = function() {
|
|
10865
10881
|
return this.size('large');
|
|
10866
10882
|
};
|
|
10867
|
-
Spinner
|
|
10883
|
+
Spinner.prototype.extraLarge = function() {
|
|
10868
10884
|
return this.size('extra-large');
|
|
10869
10885
|
};
|
|
10870
10886
|
|
|
10871
|
-
Spinner
|
|
10887
|
+
Spinner.prototype.variant = function(name) {
|
|
10872
10888
|
this.$description.variant = name;
|
|
10873
10889
|
return this;
|
|
10874
10890
|
};
|
|
10875
|
-
Spinner
|
|
10891
|
+
Spinner.prototype.primary = function() {
|
|
10876
10892
|
return this.variant('primary');
|
|
10877
10893
|
};
|
|
10878
|
-
Spinner
|
|
10894
|
+
Spinner.prototype.secondary = function() {
|
|
10879
10895
|
return this.variant('secondary');
|
|
10880
10896
|
};
|
|
10881
|
-
Spinner
|
|
10897
|
+
Spinner.prototype.success = function() {
|
|
10882
10898
|
return this.variant('success');
|
|
10883
10899
|
};
|
|
10884
|
-
Spinner
|
|
10900
|
+
Spinner.prototype.danger = function() {
|
|
10885
10901
|
return this.variant('danger');
|
|
10886
10902
|
};
|
|
10887
|
-
Spinner
|
|
10903
|
+
Spinner.prototype.warning = function() {
|
|
10888
10904
|
return this.variant('warning');
|
|
10889
10905
|
};
|
|
10890
|
-
Spinner
|
|
10906
|
+
Spinner.prototype.color = function(color) {
|
|
10891
10907
|
this.$description.color = color;
|
|
10892
10908
|
return this;
|
|
10893
10909
|
};
|
|
10894
10910
|
|
|
10895
|
-
Spinner
|
|
10911
|
+
Spinner.prototype.label = function(label) {
|
|
10896
10912
|
this.$description.label = label;
|
|
10897
10913
|
return this;
|
|
10898
10914
|
};
|
|
10899
|
-
Spinner
|
|
10915
|
+
Spinner.prototype.labelPosition = function(position) {
|
|
10900
10916
|
this.$description.labelPosition = position;
|
|
10901
10917
|
return this;
|
|
10902
10918
|
};
|
|
10903
|
-
Spinner
|
|
10919
|
+
Spinner.prototype.labelAtTop = function() {
|
|
10904
10920
|
return this.labelPosition('top');
|
|
10905
10921
|
};
|
|
10906
|
-
Spinner
|
|
10922
|
+
Spinner.prototype.labelAtBottom = function() {
|
|
10907
10923
|
return this.labelPosition('bottom');
|
|
10908
10924
|
};
|
|
10909
|
-
Spinner
|
|
10925
|
+
Spinner.prototype.labelAtLeft = function() {
|
|
10910
10926
|
return this.labelPosition('left');
|
|
10911
10927
|
};
|
|
10912
|
-
Spinner
|
|
10928
|
+
Spinner.prototype.labelAtRight = function() {
|
|
10913
10929
|
return this.labelPosition('right');
|
|
10914
10930
|
};
|
|
10915
10931
|
|
|
10916
|
-
Spinner
|
|
10932
|
+
Spinner.prototype.overlay = function(enabled = true) {
|
|
10917
10933
|
this.$description.overlay = enabled;
|
|
10918
10934
|
return this;
|
|
10919
10935
|
};
|
|
10920
|
-
Spinner
|
|
10936
|
+
Spinner.prototype.fullscreen = function() {
|
|
10921
10937
|
return this.overlay(true);
|
|
10922
10938
|
};
|
|
10923
|
-
Spinner
|
|
10939
|
+
Spinner.prototype.backdrop = function(enabled = true) {
|
|
10924
10940
|
this.$description.backdrop = enabled;
|
|
10925
10941
|
return this;
|
|
10926
10942
|
};
|
|
@@ -10930,29 +10946,29 @@ var NativeComponents = (function (exports) {
|
|
|
10930
10946
|
* @param {string|int} speed
|
|
10931
10947
|
* @returns {Spinner}
|
|
10932
10948
|
*/
|
|
10933
|
-
Spinner
|
|
10949
|
+
Spinner.prototype.speed = function(speed) {
|
|
10934
10950
|
this.$description.speed = speed;
|
|
10935
10951
|
return this;
|
|
10936
10952
|
};
|
|
10937
|
-
Spinner
|
|
10953
|
+
Spinner.prototype.slow = function() {
|
|
10938
10954
|
return this.speed('slow');
|
|
10939
10955
|
};
|
|
10940
|
-
Spinner
|
|
10956
|
+
Spinner.prototype.normal = function() {
|
|
10941
10957
|
return this.speed('normal');
|
|
10942
10958
|
};
|
|
10943
|
-
Spinner
|
|
10959
|
+
Spinner.prototype.fast = function() {
|
|
10944
10960
|
return this.speed('fast');
|
|
10945
10961
|
};
|
|
10946
|
-
Spinner
|
|
10962
|
+
Spinner.prototype.loading = function(isLoading) {
|
|
10947
10963
|
this.$description.loading = BaseComponent.obs(isLoading);
|
|
10948
10964
|
return this;
|
|
10949
10965
|
};
|
|
10950
|
-
Spinner
|
|
10966
|
+
Spinner.prototype.bind = Spinner.prototype.loading;
|
|
10951
10967
|
|
|
10952
|
-
Spinner
|
|
10968
|
+
Spinner.prototype.show = function() {
|
|
10953
10969
|
this.$description.loading?.set(true);
|
|
10954
10970
|
};
|
|
10955
|
-
Spinner
|
|
10971
|
+
Spinner.prototype.hide = function() {
|
|
10956
10972
|
this.$description.loading?.set(false);
|
|
10957
10973
|
};
|
|
10958
10974
|
|
|
@@ -10972,7 +10988,7 @@ var NativeComponents = (function (exports) {
|
|
|
10972
10988
|
this.$element = null;
|
|
10973
10989
|
}
|
|
10974
10990
|
|
|
10975
|
-
BaseComponent.extends(Splitter,
|
|
10991
|
+
BaseComponent.extends(Splitter, HasEventEmitter);
|
|
10976
10992
|
|
|
10977
10993
|
Splitter.defaultTemplate = null;
|
|
10978
10994
|
|
|
@@ -11153,7 +11169,7 @@ var NativeComponents = (function (exports) {
|
|
|
11153
11169
|
this.$element = null;
|
|
11154
11170
|
}
|
|
11155
11171
|
|
|
11156
|
-
BaseComponent.extends(Stepper,
|
|
11172
|
+
BaseComponent.extends(Stepper, HasEventEmitter);
|
|
11157
11173
|
|
|
11158
11174
|
Stepper.defaultTemplate = null;
|
|
11159
11175
|
Stepper.defaultStepTemplate = null;
|
|
@@ -11998,7 +12014,7 @@ var NativeComponents = (function (exports) {
|
|
|
11998
12014
|
this.tabsMap = {};
|
|
11999
12015
|
}
|
|
12000
12016
|
|
|
12001
|
-
BaseComponent.extends(Tabs,
|
|
12017
|
+
BaseComponent.extends(Tabs, HasEventEmitter);
|
|
12002
12018
|
|
|
12003
12019
|
Tabs.defaultTemplate = null;
|
|
12004
12020
|
Tabs.defaultTabTemplate = null;
|
|
@@ -12112,7 +12128,7 @@ var NativeComponents = (function (exports) {
|
|
|
12112
12128
|
};
|
|
12113
12129
|
}
|
|
12114
12130
|
|
|
12115
|
-
BaseComponent.extends(Toast,
|
|
12131
|
+
BaseComponent.extends(Toast, HasEventEmitter);
|
|
12116
12132
|
|
|
12117
12133
|
Toast.use = function(template) {};
|
|
12118
12134
|
Toast.defaultTemplate = null;
|
|
@@ -12336,6 +12352,7 @@ var NativeComponents = (function (exports) {
|
|
|
12336
12352
|
|
|
12337
12353
|
BaseComponent.extends(Stack);
|
|
12338
12354
|
|
|
12355
|
+
|
|
12339
12356
|
Stack.prototype.wrap = function(enabled = true) {
|
|
12340
12357
|
this.$description.wrap = enabled;
|
|
12341
12358
|
return this;
|
|
@@ -12390,13 +12407,16 @@ var NativeComponents = (function (exports) {
|
|
|
12390
12407
|
};
|
|
12391
12408
|
|
|
12392
12409
|
function VStack(content, props = {}) {
|
|
12393
|
-
if (!(this instanceof VStack))
|
|
12410
|
+
if (!(this instanceof VStack)) {
|
|
12411
|
+
return new VStack(content, props);
|
|
12412
|
+
}
|
|
12394
12413
|
|
|
12395
12414
|
Stack.call(this, content, props);
|
|
12415
|
+
|
|
12396
12416
|
this.$description.orientation = 'vertical';
|
|
12397
12417
|
this.$description.alignment = 'leading';
|
|
12398
12418
|
}
|
|
12399
|
-
BaseComponent.extends(VStack);
|
|
12419
|
+
BaseComponent.extends(VStack, Stack);
|
|
12400
12420
|
|
|
12401
12421
|
VStack.preset = function(name, callback) {
|
|
12402
12422
|
if (VStack.prototype[name] || VStack[name]) {
|
|
@@ -12455,7 +12475,7 @@ var NativeComponents = (function (exports) {
|
|
|
12455
12475
|
this.$description.orientation = 'horizontal';
|
|
12456
12476
|
}
|
|
12457
12477
|
|
|
12458
|
-
BaseComponent.extends(HStack);
|
|
12478
|
+
BaseComponent.extends(HStack, Stack);
|
|
12459
12479
|
|
|
12460
12480
|
HStack.preset = function(name, callback) {
|
|
12461
12481
|
if (HStack.prototype[name] || HStack[name]) {
|
|
@@ -12528,7 +12548,7 @@ var NativeComponents = (function (exports) {
|
|
|
12528
12548
|
exports.SimpleTable = SimpleTable;
|
|
12529
12549
|
exports.Skeleton = Skeleton;
|
|
12530
12550
|
exports.Slider = Slider;
|
|
12531
|
-
exports.Spinner = Spinner
|
|
12551
|
+
exports.Spinner = Spinner;
|
|
12532
12552
|
exports.Splitter = Splitter;
|
|
12533
12553
|
exports.SplitterPanel = SplitterPanel;
|
|
12534
12554
|
exports.Stack = Stack;
|
package/package.json
CHANGED
|
@@ -18,7 +18,8 @@ Object.defineProperty( BaseComponent.prototype, 'nd', {
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
BaseComponent.extends = function(Component, ...parents) {
|
|
21
|
-
|
|
21
|
+
const MainParent = parents[0] || BaseComponent;
|
|
22
|
+
Component.prototype = Object.create(MainParent.prototype);
|
|
22
23
|
|
|
23
24
|
if(parents.length > 0) {
|
|
24
25
|
for(const parent of parents) {
|
|
@@ -28,6 +29,14 @@ BaseComponent.extends = function(Component, ...parents) {
|
|
|
28
29
|
Component.prototype.constructor = Component;
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
BaseComponent.use = function(Component, ...traits) {
|
|
33
|
+
if(traits.length > 0) {
|
|
34
|
+
for(const trait of traits) {
|
|
35
|
+
Object.assign(Component.prototype, trait.prototype);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
31
40
|
BaseComponent.obs = (value) => {
|
|
32
41
|
return value.__$Observable ? value : Observable(value);
|
|
33
42
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -27,7 +27,7 @@ export default function Accordion(config = {}) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
BaseComponent.extends(Accordion,
|
|
30
|
+
BaseComponent.extends(Accordion, HasEventEmitter);
|
|
31
31
|
|
|
32
32
|
Accordion.defaultTemplate = null;
|
|
33
33
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Component for displaying alert messages with various styles and variants
|
|
@@ -41,7 +41,7 @@ Alert.use = function(template) {
|
|
|
41
41
|
Alert.defaultContentTemplate = template.alertContent;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
BaseComponent.extends(Alert,
|
|
44
|
+
BaseComponent.extends(Alert, HasEventEmitter);
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Sets the variant style for the alert
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Breadcrumb(config = {}) {
|
|
5
5
|
if (!(this instanceof Breadcrumb)) {
|
|
@@ -15,7 +15,7 @@ export default function Breadcrumb(config = {}) {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
BaseComponent.extends(Breadcrumb,
|
|
18
|
+
BaseComponent.extends(Breadcrumb, HasEventEmitter);
|
|
19
19
|
|
|
20
20
|
Breadcrumb.use = function(template) {};
|
|
21
21
|
Breadcrumb.defaultTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import DropdownGroup from "./DropdownGroup";
|
|
4
4
|
import DropdownTrigger from "./DropdownTrigger";
|
|
5
5
|
import DropdownDivider from "./DropdownDivider";
|
|
@@ -35,7 +35,7 @@ export default function Dropdown(config = {}) {
|
|
|
35
35
|
this.$element = null;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
BaseComponent.extends(Dropdown,
|
|
38
|
+
BaseComponent.extends(Dropdown, HasEventEmitter);
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
Dropdown.defaultTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {debounce} from "../../core/utils/helpers";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import {Validator, Observable as $ } from "../../../index";
|
|
4
4
|
import NativeDocumentError from "../../../src/core/errors/NativeDocumentError";
|
|
5
5
|
import BaseComponent from "../BaseComponent";
|
|
@@ -12,7 +12,7 @@ export default function FormControl(configs) {
|
|
|
12
12
|
if(!(this instanceof FormControl)) {
|
|
13
13
|
return new FormControl(configs);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
HasEventEmitter.call(this);
|
|
16
16
|
|
|
17
17
|
this.$element = null;
|
|
18
18
|
this.$configs = configs;
|
|
@@ -33,7 +33,7 @@ FormControl.create = function (configs) {
|
|
|
33
33
|
return new FormControl(configs);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
BaseComponent.extends(FormControl,
|
|
36
|
+
BaseComponent.extends(FormControl, HasEventEmitter);
|
|
37
37
|
|
|
38
38
|
Object.defineProperty(FormControl.prototype, 'isDirty', {
|
|
39
39
|
get() { return this.$isDirty; }
|
|
@@ -11,7 +11,7 @@ export default function HStack(content, props = {}) {
|
|
|
11
11
|
this.$description.orientation = 'horizontal';
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
BaseComponent.extends(HStack);
|
|
14
|
+
BaseComponent.extends(HStack, Stack);
|
|
15
15
|
|
|
16
16
|
HStack.preset = function(name, callback) {
|
|
17
17
|
if (HStack.prototype[name] || HStack[name]) {
|
|
@@ -4,13 +4,16 @@ import BaseComponent from "../BaseComponent";
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export default function VStack(content, props = {}) {
|
|
7
|
-
if (!(this instanceof VStack))
|
|
7
|
+
if (!(this instanceof VStack)) {
|
|
8
|
+
return new VStack(content, props);
|
|
9
|
+
}
|
|
8
10
|
|
|
9
11
|
Stack.call(this, content, props);
|
|
12
|
+
|
|
10
13
|
this.$description.orientation = 'vertical';
|
|
11
14
|
this.$description.alignment = 'leading';
|
|
12
15
|
}
|
|
13
|
-
BaseComponent.extends(VStack);
|
|
16
|
+
BaseComponent.extends(VStack, Stack);
|
|
14
17
|
|
|
15
18
|
VStack.preset = function(name, callback) {
|
|
16
19
|
if (VStack.prototype[name] || VStack[name]) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import BaseComponent from "../BaseComponent";
|
|
3
|
-
import
|
|
3
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
4
4
|
import HasItems from "../$traits/HasItems";
|
|
5
5
|
import Dropdown from "../dropdown/Dropdown";
|
|
6
6
|
|
|
@@ -31,7 +31,8 @@ List.use = function(template) {
|
|
|
31
31
|
List.defaultTemplate = template.list;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
BaseComponent.extends(List
|
|
34
|
+
BaseComponent.extends(List);
|
|
35
|
+
BaseComponent.use(List, HasItems, HasEventEmitter);
|
|
35
36
|
|
|
36
37
|
List.defaultTemplate = null;
|
|
37
38
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import HasItems from "../$traits/HasItems";
|
|
4
4
|
import MenuDivider from "./MenuDivider";
|
|
5
5
|
import MenuGroup from "./MenuGroup";
|
|
@@ -24,7 +24,8 @@ export default function Menu(props = {}) {
|
|
|
24
24
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
BaseComponent.extends(Menu
|
|
27
|
+
BaseComponent.extends(Menu);
|
|
28
|
+
BaseComponent.use(Menu, HasItems, HasEventEmitter);
|
|
28
29
|
|
|
29
30
|
Menu.defaultTemplate = null;
|
|
30
31
|
|
|
@@ -23,7 +23,8 @@ MenuGroup.use = function(template) {
|
|
|
23
23
|
MenuGroup.defaultTemplate = template.menuGroup;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
BaseComponent.extends(MenuGroup
|
|
26
|
+
BaseComponent.extends(MenuGroup);
|
|
27
|
+
BaseComponent.use(MenuGroup, HasItems);
|
|
27
28
|
|
|
28
29
|
MenuGroup.prototype.data = function(data) {
|
|
29
30
|
this.$description.data = data;
|
|
@@ -32,7 +32,8 @@ MenuItem.use = function(template) {
|
|
|
32
32
|
MenuItem.defaultTemplate = template.menuItem;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
BaseComponent.extends(MenuItem
|
|
35
|
+
BaseComponent.extends(MenuItem);
|
|
36
|
+
BaseComponent.use(MenuItem, HasItems);
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
MenuItem.prototype.label = function(label) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export default function Modal(config = {}) {
|
|
@@ -22,7 +22,7 @@ export default function Modal(config = {}) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
BaseComponent.extends(Modal,
|
|
25
|
+
BaseComponent.extends(Modal, HasEventEmitter);
|
|
26
26
|
|
|
27
27
|
// Theming
|
|
28
28
|
Modal.defaultLayout = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Pagination(config = {}) {
|
|
5
5
|
if(!(this instanceof Pagination)) {
|
|
@@ -31,7 +31,7 @@ export default function Pagination(config = {}) {
|
|
|
31
31
|
this.$element = null;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
BaseComponent.extends(Pagination,
|
|
34
|
+
BaseComponent.extends(Pagination, HasEventEmitter);
|
|
35
35
|
|
|
36
36
|
Pagination.defaultTemplate = null;
|
|
37
37
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Popover(config = {}) {
|
|
5
5
|
if (!(this instanceof Popover)) {
|
|
@@ -35,7 +35,7 @@ export default function Popover(config = {}) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
BaseComponent.extends(Popover,
|
|
38
|
+
BaseComponent.extends(Popover, HasEventEmitter);
|
|
39
39
|
|
|
40
40
|
Popover.defaultTemplate = null;
|
|
41
41
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import {Validator} from "../../../index";
|
|
4
4
|
import DebugManager from "../../core/utils/debug-manager";
|
|
5
5
|
|
|
@@ -30,7 +30,7 @@ export default function Progress(props = {}) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
BaseComponent.extends(Progress,
|
|
33
|
+
BaseComponent.extends(Progress, HasEventEmitter);
|
|
34
34
|
|
|
35
35
|
Progress.defaultTemplate = null;
|
|
36
36
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Slider(config = {}) {
|
|
5
5
|
if (!(this instanceof Slider)) {
|
|
@@ -33,7 +33,7 @@ export default function Slider(config = {}) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
BaseComponent.extends(Slider,
|
|
36
|
+
BaseComponent.extends(Slider, HasEventEmitter);
|
|
37
37
|
|
|
38
38
|
Slider.use = function(template) {};
|
|
39
39
|
Slider.defaultTemplate = null;
|
|
@@ -27,6 +27,8 @@ Spinner.use = function(template) {
|
|
|
27
27
|
Spinner.defaultTemplate = template.spinner;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
BaseComponent.extends(Spinner);
|
|
31
|
+
|
|
30
32
|
Spinner.preset = function(name, callback) {
|
|
31
33
|
if (Spinner.prototype[name] || Spinner[name]) {
|
|
32
34
|
DebugManager.warn(`Warning: the ${name} method already exists in Spinner.`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import {Validator} from "../../../index";
|
|
4
4
|
|
|
5
5
|
export default function Splitter(config = {}) {
|
|
@@ -18,7 +18,7 @@ export default function Splitter(config = {}) {
|
|
|
18
18
|
this.$element = null;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
BaseComponent.extends(Splitter,
|
|
21
|
+
BaseComponent.extends(Splitter, HasEventEmitter);
|
|
22
22
|
|
|
23
23
|
Splitter.defaultTemplate = null;
|
|
24
24
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import {$, Validator} from "../../../index";
|
|
4
4
|
|
|
5
5
|
export default function Stepper(config = {}) {
|
|
@@ -27,7 +27,7 @@ export default function Stepper(config = {}) {
|
|
|
27
27
|
this.$element = null;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
BaseComponent.extends(Stepper,
|
|
30
|
+
BaseComponent.extends(Stepper, HasEventEmitter);
|
|
31
31
|
|
|
32
32
|
Stepper.defaultTemplate = null;
|
|
33
33
|
Stepper.defaultStepTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
function Switch(config = {}) {
|
|
5
5
|
if (!(this instanceof Switch)) {
|
|
@@ -11,7 +11,7 @@ function Switch(config = {}) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
BaseComponent.extends(Switch,
|
|
14
|
+
BaseComponent.extends(Switch, HasEventEmitter);
|
|
15
15
|
|
|
16
16
|
// Theming
|
|
17
17
|
Switch.defaultTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export default function Tabs(config = {}) {
|
|
@@ -16,7 +16,7 @@ export default function Tabs(config = {}) {
|
|
|
16
16
|
this.tabsMap = {};
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
BaseComponent.extends(Tabs,
|
|
19
|
+
BaseComponent.extends(Tabs, HasEventEmitter);
|
|
20
20
|
|
|
21
21
|
Tabs.defaultTemplate = null;
|
|
22
22
|
Tabs.defaultTabTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Toast(message, config = {}) {
|
|
5
5
|
if (!(this instanceof Toast)) {
|
|
@@ -22,7 +22,7 @@ export default function Toast(message, config = {}) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
BaseComponent.extends(Toast,
|
|
25
|
+
BaseComponent.extends(Toast, HasEventEmitter);
|
|
26
26
|
|
|
27
27
|
Toast.use = function(template) {};
|
|
28
28
|
Toast.defaultTemplate = null;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import NativeDocumentError from "../errors/NativeDocumentError";
|
|
2
1
|
|
|
3
|
-
export default function
|
|
2
|
+
export default function HasEventEmitter() {
|
|
4
3
|
|
|
5
4
|
this.__$events = null;
|
|
6
5
|
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
HasEventEmitter.prototype.on = function(eventName, callback) {
|
|
10
9
|
if(!this.__$events) {
|
|
11
10
|
this.__$events = new Map();
|
|
12
11
|
}
|
|
@@ -22,11 +21,11 @@ EventEmitter.prototype.on = function(eventName, callback) {
|
|
|
22
21
|
existingCallback.push(callback);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
HasEventEmitter.prototype.hasListeners = function(eventName) {
|
|
26
25
|
return !!this.__$events.get(eventName);
|
|
27
26
|
};
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
HasEventEmitter.prototype.trigger = async function(eventName, ...args) {
|
|
30
29
|
const callbacks = this.__$events.get(eventName);
|
|
31
30
|
if(!callbacks) {
|
|
32
31
|
// throw new NativeDocumentError(this.constructor.name, 'Event '+eventName+' not found');
|
|
@@ -43,4 +42,4 @@ EventEmitter.prototype.trigger = async function(eventName, ...args) {
|
|
|
43
42
|
}
|
|
44
43
|
return result;
|
|
45
44
|
};
|
|
46
|
-
|
|
45
|
+
HasEventEmitter.prototype.emit = HasEventEmitter.prototype.trigger;
|