@powfix/core-js 0.24.0 → 0.24.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.
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
function _array_like_to_array(arr, len) {
|
|
3
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
-
return arr2;
|
|
6
|
-
}
|
|
7
|
-
function _array_without_holes(arr) {
|
|
8
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
9
|
-
}
|
|
10
2
|
function _assert_this_initialized(self) {
|
|
11
3
|
if (self === void 0) {
|
|
12
4
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -75,12 +67,6 @@ function _inherits(subClass, superClass) {
|
|
|
75
67
|
function _is_native_function(fn) {
|
|
76
68
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
77
69
|
}
|
|
78
|
-
function _iterable_to_array(iter) {
|
|
79
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
80
|
-
}
|
|
81
|
-
function _non_iterable_spread() {
|
|
82
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
83
|
-
}
|
|
84
70
|
function _possible_constructor_return(self, call) {
|
|
85
71
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
86
72
|
return call;
|
|
@@ -94,21 +80,10 @@ function _set_prototype_of(o, p) {
|
|
|
94
80
|
};
|
|
95
81
|
return _set_prototype_of(o, p);
|
|
96
82
|
}
|
|
97
|
-
function _to_consumable_array(arr) {
|
|
98
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
99
|
-
}
|
|
100
83
|
function _type_of(obj) {
|
|
101
84
|
"@swc/helpers - typeof";
|
|
102
85
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
103
86
|
}
|
|
104
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
105
|
-
if (!o) return;
|
|
106
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
107
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
108
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
109
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
110
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
111
|
-
}
|
|
112
87
|
function _wrap_native_super(Class) {
|
|
113
88
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
114
89
|
_wrap_native_super = function wrapNativeSuper(Class) {
|
|
@@ -148,32 +123,27 @@ var _settled, _status, _result;
|
|
|
148
123
|
var WatchablePromise = /*#__PURE__*/ function(Promise1) {
|
|
149
124
|
_inherits(WatchablePromise, Promise1);
|
|
150
125
|
function WatchablePromise(executor) {
|
|
151
|
-
var _this = this;
|
|
152
126
|
_class_call_check(this, WatchablePromise);
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
127
|
+
var _this;
|
|
128
|
+
_this = _call_super(this, WatchablePromise, [
|
|
129
|
+
function(resolve, reject) {
|
|
130
|
+
executor(function(value) {
|
|
131
|
+
resolve(value);
|
|
132
|
+
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this), _settled, true);
|
|
133
|
+
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this), _status, "fulfilled");
|
|
134
|
+
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this), _result, value);
|
|
135
|
+
}, function(reason) {
|
|
136
|
+
reject(reason);
|
|
137
|
+
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this), _settled, true);
|
|
138
|
+
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this), _status, "rejected");
|
|
139
|
+
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this), _result, reason);
|
|
140
|
+
});
|
|
157
141
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
};
|
|
164
|
-
__super(executor);
|
|
165
|
-
__super(function(resolve, reject) {
|
|
166
|
-
executor(function(value) {
|
|
167
|
-
resolve(value);
|
|
168
|
-
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this1), _status, "fulfilled");
|
|
169
|
-
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this1), _result, value);
|
|
170
|
-
}, function(reason) {
|
|
171
|
-
reject(reason);
|
|
172
|
-
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this1), _status, "rejected");
|
|
173
|
-
chunkJE77HYXB_cjs.__privateSet(_assert_this_initialized(_this1), _result, reason);
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
return _assert_this_initialized(_this1);
|
|
142
|
+
]);
|
|
143
|
+
chunkJE77HYXB_cjs.__privateAdd(_this, _settled, false);
|
|
144
|
+
chunkJE77HYXB_cjs.__privateAdd(_this, _status, "pending");
|
|
145
|
+
chunkJE77HYXB_cjs.__privateAdd(_this, _result);
|
|
146
|
+
return _this;
|
|
177
147
|
}
|
|
178
148
|
_create_class(WatchablePromise, [
|
|
179
149
|
{
|
|
@@ -194,6 +164,15 @@ var WatchablePromise = /*#__PURE__*/ function(Promise1) {
|
|
|
194
164
|
return chunkJE77HYXB_cjs.__privateGet(this, _result);
|
|
195
165
|
}
|
|
196
166
|
}
|
|
167
|
+
], [
|
|
168
|
+
{
|
|
169
|
+
key: "from",
|
|
170
|
+
value: function from(promise) {
|
|
171
|
+
return new this(function(resolve, reject) {
|
|
172
|
+
return promise.then(resolve, reject);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
197
176
|
]);
|
|
198
177
|
return WatchablePromise;
|
|
199
178
|
}(_wrap_native_super(Promise));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { WatchablePromiseStatus } from "./WatchablePromise.types.js";
|
|
1
|
+
import type { PromiseExecutor, WatchablePromiseStatus } from "./WatchablePromise.types.js";
|
|
2
2
|
export declare class WatchablePromise<T, E = Error> extends Promise<T> {
|
|
3
3
|
#private;
|
|
4
|
-
|
|
4
|
+
static from<P extends typeof WatchablePromise, T>(this: P, promise: Promise<T>): InstanceType<P>;
|
|
5
|
+
constructor(executor: PromiseExecutor<T>);
|
|
5
6
|
get settled(): boolean;
|
|
6
7
|
get status(): WatchablePromiseStatus;
|
|
7
8
|
get result(): T | PromiseLike<T> | E | undefined;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_without_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
-
}
|
|
9
1
|
function _assert_this_initialized(self) {
|
|
10
2
|
if (self === void 0) {
|
|
11
3
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -74,12 +66,6 @@ function _inherits(subClass, superClass) {
|
|
|
74
66
|
function _is_native_function(fn) {
|
|
75
67
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
76
68
|
}
|
|
77
|
-
function _iterable_to_array(iter) {
|
|
78
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
79
|
-
}
|
|
80
|
-
function _non_iterable_spread() {
|
|
81
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
82
|
-
}
|
|
83
69
|
function _possible_constructor_return(self, call) {
|
|
84
70
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
85
71
|
return call;
|
|
@@ -93,21 +79,10 @@ function _set_prototype_of(o, p) {
|
|
|
93
79
|
};
|
|
94
80
|
return _set_prototype_of(o, p);
|
|
95
81
|
}
|
|
96
|
-
function _to_consumable_array(arr) {
|
|
97
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
98
|
-
}
|
|
99
82
|
function _type_of(obj) {
|
|
100
83
|
"@swc/helpers - typeof";
|
|
101
84
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
102
85
|
}
|
|
103
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
104
|
-
if (!o) return;
|
|
105
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
106
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
107
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
108
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
109
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
110
|
-
}
|
|
111
86
|
function _wrap_native_super(Class) {
|
|
112
87
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
113
88
|
_wrap_native_super = function wrapNativeSuper(Class) {
|
|
@@ -142,38 +117,33 @@ function _is_native_reflect_construct() {
|
|
|
142
117
|
return !!result;
|
|
143
118
|
})();
|
|
144
119
|
}
|
|
145
|
-
import {
|
|
120
|
+
import { __privateSet, __privateAdd, __privateGet } from '../../chunk-AQ5VUG5P.js';
|
|
146
121
|
var _settled, _status, _result;
|
|
147
122
|
var WatchablePromise = /*#__PURE__*/ function(Promise1) {
|
|
148
123
|
"use strict";
|
|
149
124
|
_inherits(WatchablePromise, Promise1);
|
|
150
125
|
function WatchablePromise(executor) {
|
|
151
|
-
var _this = this;
|
|
152
126
|
_class_call_check(this, WatchablePromise);
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
127
|
+
var _this;
|
|
128
|
+
_this = _call_super(this, WatchablePromise, [
|
|
129
|
+
function(resolve, reject) {
|
|
130
|
+
executor(function(value) {
|
|
131
|
+
resolve(value);
|
|
132
|
+
__privateSet(_assert_this_initialized(_this), _settled, true);
|
|
133
|
+
__privateSet(_assert_this_initialized(_this), _status, "fulfilled");
|
|
134
|
+
__privateSet(_assert_this_initialized(_this), _result, value);
|
|
135
|
+
}, function(reason) {
|
|
136
|
+
reject(reason);
|
|
137
|
+
__privateSet(_assert_this_initialized(_this), _settled, true);
|
|
138
|
+
__privateSet(_assert_this_initialized(_this), _status, "rejected");
|
|
139
|
+
__privateSet(_assert_this_initialized(_this), _result, reason);
|
|
140
|
+
});
|
|
157
141
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
};
|
|
164
|
-
__super(executor);
|
|
165
|
-
__super(function(resolve, reject) {
|
|
166
|
-
executor(function(value) {
|
|
167
|
-
resolve(value);
|
|
168
|
-
__privateSet(_assert_this_initialized(_this1), _status, "fulfilled");
|
|
169
|
-
__privateSet(_assert_this_initialized(_this1), _result, value);
|
|
170
|
-
}, function(reason) {
|
|
171
|
-
reject(reason);
|
|
172
|
-
__privateSet(_assert_this_initialized(_this1), _status, "rejected");
|
|
173
|
-
__privateSet(_assert_this_initialized(_this1), _result, reason);
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
return _assert_this_initialized(_this1);
|
|
142
|
+
]);
|
|
143
|
+
__privateAdd(_this, _settled, false);
|
|
144
|
+
__privateAdd(_this, _status, "pending");
|
|
145
|
+
__privateAdd(_this, _result);
|
|
146
|
+
return _this;
|
|
177
147
|
}
|
|
178
148
|
_create_class(WatchablePromise, [
|
|
179
149
|
{
|
|
@@ -194,6 +164,15 @@ var WatchablePromise = /*#__PURE__*/ function(Promise1) {
|
|
|
194
164
|
return __privateGet(this, _result);
|
|
195
165
|
}
|
|
196
166
|
}
|
|
167
|
+
], [
|
|
168
|
+
{
|
|
169
|
+
key: "from",
|
|
170
|
+
value: function from(promise) {
|
|
171
|
+
return new this(function(resolve, reject) {
|
|
172
|
+
return promise.then(resolve, reject);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
197
176
|
]);
|
|
198
177
|
return WatchablePromise;
|
|
199
178
|
}(_wrap_native_super(Promise));
|