@schukai/monster 3.80.1 → 3.80.3
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/CHANGELOG.md +26 -0
- package/package.json +1 -1
- package/source/components/content/copy.mjs +7 -4
- package/source/components/datatable/change-button.mjs +1 -1
- package/source/components/datatable/columnbar.mjs +1 -1
- package/source/components/datatable/dataset.mjs +3 -3
- package/source/components/datatable/datasource/dom.mjs +2 -2
- package/source/components/datatable/datasource/rest.mjs +7 -7
- package/source/components/datatable/datasource.mjs +3 -3
- package/source/components/datatable/datatable/header.mjs +11 -11
- package/source/components/datatable/datatable.mjs +15 -15
- package/source/components/datatable/embedded-pagination.mjs +2 -2
- package/source/components/datatable/filter/date-range.mjs +5 -5
- package/source/components/datatable/filter/input.mjs +2 -2
- package/source/components/datatable/filter/range.mjs +3 -3
- package/source/components/datatable/filter/settings.mjs +5 -5
- package/source/components/datatable/filter/util.mjs +3 -3
- package/source/components/datatable/filter-button.mjs +1 -1
- package/source/components/datatable/filter.mjs +11 -11
- package/source/components/datatable/pagination.mjs +3 -3
- package/source/components/datatable/save-button.mjs +1 -1
- package/source/components/datatable/status.mjs +1 -1
- package/source/components/form/action-button.mjs +2 -2
- package/source/components/form/api-button.mjs +1 -1
- package/source/components/form/button-bar.mjs +3 -3
- package/source/components/form/confirm-button.mjs +4 -4
- package/source/components/form/context-error.mjs +4 -4
- package/source/components/form/context-help.mjs +1 -1
- package/source/components/form/field-set.mjs +2 -2
- package/source/components/form/form.mjs +3 -3
- package/source/components/form/message-state-button.mjs +6 -6
- package/source/components/form/popper-button.mjs +1 -1
- package/source/components/form/reload.mjs +5 -22
- package/source/components/form/select.mjs +11 -10
- package/source/components/form/shadow-reload.mjs +1 -1
- package/source/components/form/state-button.mjs +1 -1
- package/source/components/form/template.mjs +4 -4
- package/source/components/form/toggle-switch.mjs +1 -1
- package/source/components/form/tree-select.mjs +1 -1
- package/source/components/form/util/floating-ui.mjs +1 -1
- package/source/components/host/call-button.mjs +1 -1
- package/source/components/host/config-manager.mjs +6 -6
- package/source/components/host/host.mjs +8 -8
- package/source/components/host/overlay.mjs +13 -13
- package/source/components/host/toggle-button.mjs +1 -1
- package/source/components/host/util.mjs +1 -1
- package/source/components/host/viewer.mjs +5 -5
- package/source/components/layout/collapse.mjs +20 -19
- package/source/components/layout/details.mjs +5 -5
- package/source/components/layout/iframe.mjs +2 -2
- package/source/components/layout/panel.mjs +3 -3
- package/source/components/layout/popper.mjs +1 -1
- package/source/components/layout/slider.mjs +6 -6
- package/source/components/layout/split-panel.mjs +3 -3
- package/source/components/layout/tabs.mjs +3 -9
- package/source/components/layout/width-toggle.mjs +4 -4
- package/source/components/navigation/table-of-content.mjs +3 -3
- package/source/components/notify/message.mjs +0 -1
- package/source/components/state/log/entry.mjs +6 -6
- package/source/components/state/log.mjs +3 -39
- package/source/components/state/state.mjs +1 -1
- package/source/components/style/space.pcss +1 -1
- package/source/components/tree-menu/dragable-tree-menu.mjs +2 -2
- package/source/components/tree-menu/tree-menu.mjs +1 -1
- package/source/constraints/abstract.mjs +2 -2
- package/source/constraints/abstractoperator.mjs +1 -1
- package/source/constraints/andoperator.mjs +5 -5
- package/source/constraints/invalid.mjs +5 -5
- package/source/constraints/isarray.mjs +5 -5
- package/source/constraints/isobject.mjs +5 -5
- package/source/constraints/oroperator.mjs +5 -5
- package/source/constraints/valid.mjs +4 -4
- package/source/data/buildmap.mjs +2 -1
- package/source/data/datasource/dom.mjs +1 -1
- package/source/data/datasource/server/restapi/data-fetch-error.mjs +1 -2
- package/source/data/datasource/server/restapi/writeerror.mjs +1 -1
- package/source/data/datasource/server/restapi.mjs +2 -2
- package/source/data/datasource/server/webconnect.mjs +4 -4
- package/source/data/datasource/server.mjs +5 -5
- package/source/data/datasource/storage/localstorage.mjs +1 -1
- package/source/data/datasource/storage/sessionstorage.mjs +1 -1
- package/source/data/datasource/storage.mjs +1 -1
- package/source/data/datasource.mjs +4 -5
- package/source/data/pathfinder.mjs +10 -9
- package/source/data/pipe.mjs +5 -4
- package/source/data/transformer.mjs +23 -11
- package/source/dom/assembler.mjs +2 -2
- package/source/dom/attributes.mjs +2 -2
- package/source/dom/customcontrol.mjs +1 -26
- package/source/dom/customelement.mjs +36 -75
- package/source/dom/dimension.mjs +3 -3
- package/source/dom/focusmanager.mjs +1 -1
- package/source/dom/locale.mjs +1 -1
- package/source/dom/resource/data.mjs +1 -1
- package/source/dom/resource/link/stylesheet.mjs +1 -1
- package/source/dom/resource/link.mjs +1 -1
- package/source/dom/resource/script.mjs +1 -1
- package/source/dom/template.mjs +2 -2
- package/source/dom/theme.mjs +2 -2
- package/source/dom/updater.mjs +5 -6
- package/source/dom/util/extract-keys.mjs +1 -1
- package/source/dom/util/init-options-from-attributes.mjs +1 -1
- package/source/dom/util/set-option-from-attribute.mjs +1 -1
- package/source/dom/util.mjs +9 -9
- package/source/i18n/formatter.mjs +1 -3
- package/source/i18n/locale.mjs +2 -4
- package/source/i18n/provider.mjs +1 -3
- package/source/i18n/providers/embed.mjs +1 -3
- package/source/i18n/translations.mjs +2 -3
- package/source/logging/handler/console.mjs +1 -2
- package/source/logging/handler.mjs +11 -12
- package/source/logging/logentry.mjs +2 -2
- package/source/logging/logger.mjs +13 -22
- package/source/math/random.mjs +2 -2
- package/source/monster.mjs +1 -0
- package/source/net/webconnect/message.mjs +3 -4
- package/source/net/webconnect.mjs +10 -10
- package/source/text/bracketed-key-value-hash.mjs +2 -2
- package/source/text/generate-range-comparison-expression.mjs +1 -1
- package/source/types/base.mjs +4 -4
- package/source/types/basewithoptions.mjs +3 -5
- package/source/types/dataurl.mjs +6 -8
- package/source/types/global.mjs +2 -2
- package/source/types/internal.mjs +3 -3
- package/source/types/is.mjs +10 -20
- package/source/types/mediatype.mjs +1 -1
- package/source/types/node.mjs +1 -1
- package/source/types/nodelist.mjs +7 -7
- package/source/types/noderecursiveiterator.mjs +1 -5
- package/source/types/observablequeue.mjs +7 -11
- package/source/types/observer.mjs +6 -9
- package/source/types/observerlist.mjs +0 -2
- package/source/types/proxyobserver.mjs +8 -8
- package/source/types/queue.mjs +3 -4
- package/source/types/stack.mjs +3 -3
- package/source/types/tokenlist.mjs +12 -12
- package/source/types/uniquequeue.mjs +2 -2
- package/source/types/version.mjs +4 -4
- package/source/util/clone.mjs +2 -2
- package/source/util/comparator.mjs +1 -2
- package/source/util/deadmansswitch.mjs +7 -5
- package/source/util/freeze.mjs +1 -1
- package/source/util/processing/callback.mjs +56 -0
- package/source/util/processing.mjs +4 -42
- package/source/util/runtime.mjs +1 -1
|
@@ -57,7 +57,7 @@ class ProxyObserver extends Base {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* This method is called by the `instanceof` operator.
|
|
60
|
-
* @
|
|
60
|
+
* @return {symbol}
|
|
61
61
|
* @since 2.1.0
|
|
62
62
|
*/
|
|
63
63
|
static get [instanceSymbol]() {
|
|
@@ -65,7 +65,7 @@ class ProxyObserver extends Base {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* @
|
|
68
|
+
* @return {object}
|
|
69
69
|
*/
|
|
70
70
|
getSubject() {
|
|
71
71
|
return this.subject;
|
|
@@ -93,7 +93,7 @@ class ProxyObserver extends Base {
|
|
|
93
93
|
*
|
|
94
94
|
* Changes to this object are not noticed by the observers, so you can make a large number of changes and inform the observers later.
|
|
95
95
|
*
|
|
96
|
-
* @
|
|
96
|
+
* @return {object}
|
|
97
97
|
*/
|
|
98
98
|
getRealSubject() {
|
|
99
99
|
return this.realSubject;
|
|
@@ -103,7 +103,7 @@ class ProxyObserver extends Base {
|
|
|
103
103
|
* attach a new observer
|
|
104
104
|
*
|
|
105
105
|
* @param {Observer} observer
|
|
106
|
-
* @
|
|
106
|
+
* @return {ProxyObserver}
|
|
107
107
|
*/
|
|
108
108
|
attachObserver(observer) {
|
|
109
109
|
this.observers.attach(observer);
|
|
@@ -114,7 +114,7 @@ class ProxyObserver extends Base {
|
|
|
114
114
|
* detach a observer
|
|
115
115
|
*
|
|
116
116
|
* @param {Observer} observer
|
|
117
|
-
* @
|
|
117
|
+
* @return {ProxyObserver}
|
|
118
118
|
*/
|
|
119
119
|
detachObserver(observer) {
|
|
120
120
|
this.observers.detach(observer);
|
|
@@ -124,7 +124,7 @@ class ProxyObserver extends Base {
|
|
|
124
124
|
/**
|
|
125
125
|
* notify all observer
|
|
126
126
|
*
|
|
127
|
-
* @
|
|
127
|
+
* @return {Promise}
|
|
128
128
|
*/
|
|
129
129
|
notifyObservers() {
|
|
130
130
|
return this.observers.notify(this);
|
|
@@ -132,7 +132,7 @@ class ProxyObserver extends Base {
|
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* @param {Observer} observer
|
|
135
|
-
* @
|
|
135
|
+
* @return {boolean}
|
|
136
136
|
*/
|
|
137
137
|
containsObserver(observer) {
|
|
138
138
|
return this.observers.contains(observer);
|
|
@@ -141,7 +141,7 @@ class ProxyObserver extends Base {
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
*
|
|
144
|
-
* @
|
|
144
|
+
* @return {{defineProperty: (function(*=, *=, *=): *), setPrototypeOf: (function(*, *=): boolean), set: (function(*, *, *, *): boolean), get: ((function(*=, *=, *=): (undefined))|*), deleteProperty: ((function(*, *): (boolean))|*)}}
|
|
145
145
|
* @private
|
|
146
146
|
* @see {@link https://gitlab.schukai.com/-/snippets/49}
|
|
147
147
|
*/
|
package/source/types/queue.mjs
CHANGED
|
@@ -28,7 +28,6 @@ export { Queue };
|
|
|
28
28
|
*
|
|
29
29
|
* @license AGPLv3
|
|
30
30
|
* @since 1.4.0
|
|
31
|
-
* @copyright schukai GmbH
|
|
32
31
|
* @summary A Queue (Fifo)
|
|
33
32
|
*/
|
|
34
33
|
class Queue extends Base {
|
|
@@ -42,7 +41,7 @@ class Queue extends Base {
|
|
|
42
41
|
|
|
43
42
|
/**
|
|
44
43
|
* This method is called by the `instanceof` operator.
|
|
45
|
-
* @
|
|
44
|
+
* @return {symbol}
|
|
46
45
|
* @since 2.1.0
|
|
47
46
|
*/
|
|
48
47
|
static get [instanceSymbol]() {
|
|
@@ -73,7 +72,7 @@ class Queue extends Base {
|
|
|
73
72
|
* Add a new element to the end of the queue.
|
|
74
73
|
*
|
|
75
74
|
* @param {*} value
|
|
76
|
-
* @
|
|
75
|
+
* @return {Queue}
|
|
77
76
|
*/
|
|
78
77
|
add(value) {
|
|
79
78
|
this.data.push(value);
|
|
@@ -83,7 +82,7 @@ class Queue extends Base {
|
|
|
83
82
|
/**
|
|
84
83
|
* remove all entries
|
|
85
84
|
*
|
|
86
|
-
* @
|
|
85
|
+
* @return {Queue}
|
|
87
86
|
*/
|
|
88
87
|
clear() {
|
|
89
88
|
this.data = [];
|
package/source/types/stack.mjs
CHANGED
|
@@ -34,7 +34,7 @@ class Stack extends Base {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* This method is called by the `instanceof` operator.
|
|
37
|
-
* @
|
|
37
|
+
* @return {symbol}
|
|
38
38
|
* @since 2.1.0
|
|
39
39
|
*/
|
|
40
40
|
static get [instanceSymbol]() {
|
|
@@ -65,7 +65,7 @@ class Stack extends Base {
|
|
|
65
65
|
* pushes an item onto the top of this stack.
|
|
66
66
|
*
|
|
67
67
|
* @param {*} value
|
|
68
|
-
* @
|
|
68
|
+
* @return {Queue}
|
|
69
69
|
*/
|
|
70
70
|
push(value) {
|
|
71
71
|
this.data.push(value);
|
|
@@ -75,7 +75,7 @@ class Stack extends Base {
|
|
|
75
75
|
/**
|
|
76
76
|
* remove all entries
|
|
77
77
|
*
|
|
78
|
-
* @
|
|
78
|
+
* @return {Queue}
|
|
79
79
|
*/
|
|
80
80
|
clear() {
|
|
81
81
|
this.data = [];
|
|
@@ -46,7 +46,7 @@ class TokenList extends Base {
|
|
|
46
46
|
/**
|
|
47
47
|
* Iterator protocol
|
|
48
48
|
*
|
|
49
|
-
* @
|
|
49
|
+
* @return {Symbol.iterator}
|
|
50
50
|
*/
|
|
51
51
|
getIterator() {
|
|
52
52
|
return this[Symbol.iterator]();
|
|
@@ -55,7 +55,7 @@ class TokenList extends Base {
|
|
|
55
55
|
/**
|
|
56
56
|
* Iterator
|
|
57
57
|
*
|
|
58
|
-
* @
|
|
58
|
+
* @return {{next: ((function(): ({value: *, done: boolean}))|*)}}
|
|
59
59
|
*/
|
|
60
60
|
[Symbol.iterator]() {
|
|
61
61
|
// Use a new index for each iterator. This makes multiple
|
|
@@ -80,7 +80,7 @@ class TokenList extends Base {
|
|
|
80
80
|
*
|
|
81
81
|
* @externalExample ../../example/types/tokenlist-2.mjs
|
|
82
82
|
* @param {array|string|iteratable} value
|
|
83
|
-
* @
|
|
83
|
+
* @return {boolean}
|
|
84
84
|
*/
|
|
85
85
|
contains(value) {
|
|
86
86
|
if (isString(value)) {
|
|
@@ -111,7 +111,7 @@ class TokenList extends Base {
|
|
|
111
111
|
*
|
|
112
112
|
* @externalExample ../../example/types/tokenlist-3.mjs
|
|
113
113
|
* @param {array|string|iteratable} value
|
|
114
|
-
* @
|
|
114
|
+
* @return {TokenList}
|
|
115
115
|
* @throws {TypeError} unsupported value
|
|
116
116
|
*/
|
|
117
117
|
add(value) {
|
|
@@ -134,7 +134,7 @@ class TokenList extends Base {
|
|
|
134
134
|
/**
|
|
135
135
|
* remove all tokens
|
|
136
136
|
*
|
|
137
|
-
* @
|
|
137
|
+
* @return {TokenList}
|
|
138
138
|
*/
|
|
139
139
|
clear() {
|
|
140
140
|
this.tokens.clear();
|
|
@@ -146,7 +146,7 @@ class TokenList extends Base {
|
|
|
146
146
|
*
|
|
147
147
|
* @externalExample ../../example/types/tokenlist-4.mjs
|
|
148
148
|
* @param {array|string|iteratable} value
|
|
149
|
-
* @
|
|
149
|
+
* @return {TokenList}
|
|
150
150
|
* @throws {TypeError} unsupported value
|
|
151
151
|
*/
|
|
152
152
|
remove(value) {
|
|
@@ -174,7 +174,7 @@ class TokenList extends Base {
|
|
|
174
174
|
*
|
|
175
175
|
* @param {string} token
|
|
176
176
|
* @param {string} newToken
|
|
177
|
-
* @
|
|
177
|
+
* @return {TokenList}
|
|
178
178
|
*/
|
|
179
179
|
replace(token, newToken) {
|
|
180
180
|
validateString(token);
|
|
@@ -199,7 +199,7 @@ class TokenList extends Base {
|
|
|
199
199
|
*
|
|
200
200
|
* @externalExample ../../example/types/tokenlist-5.mjs
|
|
201
201
|
* @param {array|string|iteratable} value
|
|
202
|
-
* @
|
|
202
|
+
* @return {boolean}
|
|
203
203
|
* @throws {TypeError} unsupported value
|
|
204
204
|
*/
|
|
205
205
|
toggle(value) {
|
|
@@ -221,7 +221,7 @@ class TokenList extends Base {
|
|
|
221
221
|
/**
|
|
222
222
|
* returns an array with all tokens
|
|
223
223
|
*
|
|
224
|
-
* @
|
|
224
|
+
* @return {array}
|
|
225
225
|
*/
|
|
226
226
|
entries() {
|
|
227
227
|
return Array.from(this.tokens);
|
|
@@ -231,7 +231,7 @@ class TokenList extends Base {
|
|
|
231
231
|
* executes the provided function with each value of the set
|
|
232
232
|
*
|
|
233
233
|
* @param {function} callback
|
|
234
|
-
* @
|
|
234
|
+
* @return {TokenList}
|
|
235
235
|
*/
|
|
236
236
|
forEach(callback) {
|
|
237
237
|
validateFunction(callback);
|
|
@@ -242,7 +242,7 @@ class TokenList extends Base {
|
|
|
242
242
|
/**
|
|
243
243
|
* returns the individual tokens separated by a blank character
|
|
244
244
|
*
|
|
245
|
-
* @
|
|
245
|
+
* @return {string}
|
|
246
246
|
*/
|
|
247
247
|
toString() {
|
|
248
248
|
return this.entries().join(" ");
|
|
@@ -252,7 +252,7 @@ class TokenList extends Base {
|
|
|
252
252
|
/**
|
|
253
253
|
* @private
|
|
254
254
|
* @param token
|
|
255
|
-
* @
|
|
255
|
+
* @return {toggleValue}
|
|
256
256
|
* @throws {Error} must be called with TokenList.call
|
|
257
257
|
*/
|
|
258
258
|
function toggleValue(token) {
|
|
@@ -41,7 +41,7 @@ class UniqueQueue extends Queue {
|
|
|
41
41
|
* Add a new element to the end of the queue.
|
|
42
42
|
*
|
|
43
43
|
* @param {object} value
|
|
44
|
-
* @
|
|
44
|
+
* @return {Queue}
|
|
45
45
|
* @throws {TypeError} value is not a object
|
|
46
46
|
*/
|
|
47
47
|
add(value) {
|
|
@@ -58,7 +58,7 @@ class UniqueQueue extends Queue {
|
|
|
58
58
|
/**
|
|
59
59
|
* remove all entries
|
|
60
60
|
*
|
|
61
|
-
* @
|
|
61
|
+
* @return {Queue}
|
|
62
62
|
*/
|
|
63
63
|
clear() {
|
|
64
64
|
super.clear();
|
package/source/types/version.mjs
CHANGED
|
@@ -82,7 +82,7 @@ class Version extends Base {
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* This method is called by the `instanceof` operator.
|
|
85
|
-
* @
|
|
85
|
+
* @return {symbol}
|
|
86
86
|
* @since 2.1.0
|
|
87
87
|
*/
|
|
88
88
|
static get [instanceSymbol]() {
|
|
@@ -91,7 +91,7 @@ class Version extends Base {
|
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
*
|
|
94
|
-
* @
|
|
94
|
+
* @return {string}
|
|
95
95
|
*/
|
|
96
96
|
toString() {
|
|
97
97
|
return `${this.major}.${this.minor}.${this.patch}`;
|
|
@@ -102,7 +102,7 @@ class Version extends Base {
|
|
|
102
102
|
* than the compared version
|
|
103
103
|
*
|
|
104
104
|
* @param {string|Version} version Version to compare
|
|
105
|
-
* @
|
|
105
|
+
* @return {number}
|
|
106
106
|
*/
|
|
107
107
|
compareTo(version) {
|
|
108
108
|
if (version instanceof Version) {
|
|
@@ -144,7 +144,7 @@ let monsterVersion;
|
|
|
144
144
|
/**
|
|
145
145
|
* Version of monster
|
|
146
146
|
*
|
|
147
|
-
* @
|
|
147
|
+
* @return {Version}
|
|
148
148
|
* @license AGPLv3
|
|
149
149
|
* @since 1.0.0
|
|
150
150
|
* @copyright schukai GmbH
|
package/source/util/clone.mjs
CHANGED
|
@@ -29,7 +29,7 @@ export { clone };
|
|
|
29
29
|
* If an object has a method `getClone()`, this method is used to create the clone.
|
|
30
30
|
*
|
|
31
31
|
* @param {*} obj object to be cloned
|
|
32
|
-
* @
|
|
32
|
+
* @return {*}
|
|
33
33
|
* @license AGPLv3
|
|
34
34
|
* @since 1.0.0
|
|
35
35
|
* @memberOf Monster.Util
|
|
@@ -106,7 +106,7 @@ function clone(obj) {
|
|
|
106
106
|
/**
|
|
107
107
|
*
|
|
108
108
|
* @param {object} obj
|
|
109
|
-
* @
|
|
109
|
+
* @return {object}
|
|
110
110
|
* @private
|
|
111
111
|
*/
|
|
112
112
|
function cloneObject(obj) {
|
|
@@ -38,10 +38,9 @@ export { Comparator };
|
|
|
38
38
|
* }).equal({v: 2}, {v: 2}); // ↦ true
|
|
39
39
|
* ```
|
|
40
40
|
*
|
|
41
|
-
* @
|
|
41
|
+
* @example /example/comparator/simple/ Simple example
|
|
42
42
|
* @license AGPLv3
|
|
43
43
|
* @since 1.3.0
|
|
44
|
-
* @memberOf Monster.Util
|
|
45
44
|
*/
|
|
46
45
|
class Comparator extends Base {
|
|
47
46
|
/**
|
|
@@ -21,13 +21,13 @@ import { validateFunction, validateInteger } from "../types/validate.mjs";
|
|
|
21
21
|
export { DeadMansSwitch };
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* The dead man's switch allows
|
|
24
|
+
* The dead man's switch allows setting a timer which can be reset again
|
|
25
|
+
* and again within a defined period of time.
|
|
25
26
|
*
|
|
26
|
-
* @
|
|
27
|
+
* @example /example/util/deadmansswitch/simple/ Simple example
|
|
27
28
|
* @copyright schukai GmbH
|
|
28
29
|
* @license AGPLv3
|
|
29
30
|
* @since 1.29.0
|
|
30
|
-
* @memberOf Monster.Util
|
|
31
31
|
* @summary Class to be able to execute function chains
|
|
32
32
|
*/
|
|
33
33
|
class DeadMansSwitch extends Base {
|
|
@@ -46,8 +46,10 @@ class DeadMansSwitch extends Base {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @
|
|
49
|
+
* @param delay
|
|
50
|
+
* @returns {DeadMansSwitch}
|
|
51
|
+
* @throws {Error} has already run
|
|
52
|
+
* @throws {Error} unsupported argument
|
|
51
53
|
*/
|
|
52
54
|
touch(delay) {
|
|
53
55
|
if (this[internalSymbol]["isAlreadyRun"] === true) {
|
package/source/util/freeze.mjs
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, {{copyRightYear}}. All rights reserved.
|
|
3
|
+
* Node module: @schukai/monster
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
11
|
+
*
|
|
12
|
+
* SPDX-License-Identifier: AGPL-3.0
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { internalSymbol } from "../../constants.mjs";
|
|
16
|
+
import { getGlobalFunction } from "../../types/global.mjs";
|
|
17
|
+
import { validateFunction, validateInteger } from "../../types/validate.mjs";
|
|
18
|
+
|
|
19
|
+
export { Callback };
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
class Callback {
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param {function} callback
|
|
28
|
+
* @param {int|undefined} time
|
|
29
|
+
* @throws {TypeError} value is not a function
|
|
30
|
+
* @throws {TypeError} value is not an integer
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
constructor(callback, time) {
|
|
34
|
+
this[internalSymbol] = {
|
|
35
|
+
callback: validateFunction(callback),
|
|
36
|
+
time: validateInteger(time ?? 0),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @private
|
|
42
|
+
* @param {*} data
|
|
43
|
+
* @return {Promise}
|
|
44
|
+
*/
|
|
45
|
+
run(data) {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
getGlobalFunction("setTimeout")(() => {
|
|
48
|
+
try {
|
|
49
|
+
resolve(this[internalSymbol].callback(data));
|
|
50
|
+
} catch (e) {
|
|
51
|
+
reject(e);
|
|
52
|
+
}
|
|
53
|
+
}, this[internalSymbol].time);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -14,52 +14,14 @@
|
|
|
14
14
|
|
|
15
15
|
import { internalSymbol } from "../constants.mjs";
|
|
16
16
|
import { Base } from "../types/base.mjs";
|
|
17
|
-
import { getGlobalFunction } from "../types/global.mjs";
|
|
18
17
|
import { isFunction, isInteger } from "../types/is.mjs";
|
|
19
18
|
import { Queue } from "../types/queue.mjs";
|
|
20
|
-
import {
|
|
19
|
+
import { Callback } from "./processing/callback.mjs";
|
|
21
20
|
|
|
22
21
|
export { Processing };
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
class Callback {
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param {function} callback
|
|
31
|
-
* @param {int|undefined} time
|
|
32
|
-
* @throws {TypeError} value is not a function
|
|
33
|
-
* @throws {TypeError} value is not an integer
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
|
-
constructor(callback, time) {
|
|
37
|
-
this[internalSymbol] = {
|
|
38
|
-
callback: validateFunction(callback),
|
|
39
|
-
time: validateInteger(time ?? 0),
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @private
|
|
45
|
-
* @param {*} data
|
|
46
|
-
* @return {Promise}
|
|
47
|
-
*/
|
|
48
|
-
run(data) {
|
|
49
|
-
return new Promise((resolve, reject) => {
|
|
50
|
-
getGlobalFunction("setTimeout")(() => {
|
|
51
|
-
try {
|
|
52
|
-
resolve(this[internalSymbol].callback(data));
|
|
53
|
-
} catch (e) {
|
|
54
|
-
reject(e);
|
|
55
|
-
}
|
|
56
|
-
}, this[internalSymbol].time);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* This class allows to execute several functions in order.
|
|
24
|
+
* This class allows executing several functions in order.
|
|
63
25
|
*
|
|
64
26
|
* Functions and timeouts can be passed. If a timeout is passed, it applies to all further functions.
|
|
65
27
|
* In the example
|
|
@@ -72,11 +34,11 @@ class Callback {
|
|
|
72
34
|
*
|
|
73
35
|
* The result of `run()` is a promise.
|
|
74
36
|
*
|
|
75
|
-
* @
|
|
37
|
+
* @example /examples/libraries/util/processing/simple/ A simple example
|
|
38
|
+
*
|
|
76
39
|
* @copyright schukai GmbH
|
|
77
40
|
* @license AGPLv3
|
|
78
41
|
* @since 1.21.0
|
|
79
|
-
* @memberOf Monster.Util
|
|
80
42
|
* @summary Class to be able to execute function chains
|
|
81
43
|
*/
|
|
82
44
|
class Processing extends Base {
|
package/source/util/runtime.mjs
CHANGED
|
@@ -64,7 +64,7 @@ const ENV_UNKNOWN = "unknown";
|
|
|
64
64
|
*
|
|
65
65
|
* @since 3.34.0
|
|
66
66
|
* @memberOf Monster.Util
|
|
67
|
-
* @
|
|
67
|
+
* @return {string} The detected runtime environment. Possible values are:
|
|
68
68
|
*/
|
|
69
69
|
function detectRuntimeEnvironment() {
|
|
70
70
|
// AWS Lambda environment
|