@builder.io/sdk 3.0.2-2 → 3.0.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/.yarnrc.yml +1 -0
- package/CHANGELOG.md +13 -0
- package/dist/index.browser.js +71 -18
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +71 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +71 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -49
- package/dist/index.umd.js +71 -18
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -3
- package/dist/src/builder.class.d.ts +7 -0
- package/dist/src/builder.class.js +70 -17
- package/dist/src/builder.class.js.map +1 -1
- package/dist/src/builder.class.test.js +757 -170
- package/dist/src/builder.class.test.js.map +1 -1
- package/dist/src/classes/animator.class.js +195 -218
- package/dist/src/classes/observable.class.js +97 -102
- package/dist/src/classes/promise.class.js +154 -150
- package/dist/src/classes/query-string.class.js +74 -73
- package/dist/src/classes/query-string.class.test.js +20 -20
- package/dist/src/constants/builder.js +4 -4
- package/dist/src/functions/assign.function.js +19 -19
- package/dist/src/functions/fetch.function.js +75 -97
- package/dist/src/functions/finder.function.js +274 -389
- package/dist/src/functions/next-tick.function.js +23 -26
- package/dist/src/functions/omit.function.js +13 -13
- package/dist/src/functions/server-only-require.function.js +9 -10
- package/dist/src/functions/throttle.function.js +37 -35
- package/dist/src/functions/to-error.js +6 -5
- package/dist/src/functions/uuid.js +8 -9
- package/dist/src/types/api-version.js +3 -3
- package/dist/src/types/content.js +3 -3
- package/dist/src/types/element.js +3 -3
- package/dist/src/url.js +42 -41
- package/dist/src/url.test.js +118 -222
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -6
- package/dist/src/functions/get-top-level-domain.d.ts +0 -6
- package/dist/src/functions/get-top-level-domain.js +0 -17
- package/dist/src/functions/get-top-level-domain.js.map +0 -1
|
@@ -1,115 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Observable = exports.Observer = exports.BehaviorSubject = exports.Subscription = void 0;
|
|
4
4
|
var Subscription = /** @class */ (function () {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(Subscription.prototype, 'closed', {
|
|
12
|
-
get: function () {
|
|
13
|
-
return this.unsubscribed;
|
|
14
|
-
},
|
|
15
|
-
enumerable: false,
|
|
16
|
-
configurable: true,
|
|
17
|
-
});
|
|
18
|
-
Subscription.prototype.add = function (subscription) {
|
|
19
|
-
this.otherSubscriptions.push(subscription);
|
|
20
|
-
};
|
|
21
|
-
Subscription.prototype.unsubscribe = function () {
|
|
22
|
-
if (this.unsubscribed) {
|
|
23
|
-
return;
|
|
5
|
+
function Subscription(listeners, listener) {
|
|
6
|
+
this.listeners = listeners;
|
|
7
|
+
this.listener = listener;
|
|
8
|
+
this.unsubscribed = false;
|
|
9
|
+
this.otherSubscriptions = [];
|
|
24
10
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.otherSubscriptions.forEach(function (sub) {
|
|
32
|
-
return sub.unsubscribe();
|
|
11
|
+
Object.defineProperty(Subscription.prototype, "closed", {
|
|
12
|
+
get: function () {
|
|
13
|
+
return this.unsubscribed;
|
|
14
|
+
},
|
|
15
|
+
enumerable: false,
|
|
16
|
+
configurable: true
|
|
33
17
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
18
|
+
Subscription.prototype.add = function (subscription) {
|
|
19
|
+
this.otherSubscriptions.push(subscription);
|
|
20
|
+
};
|
|
21
|
+
Subscription.prototype.unsubscribe = function () {
|
|
22
|
+
if (this.unsubscribed) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (this.listener && this.listeners) {
|
|
26
|
+
var index = this.listeners.indexOf(this.listener);
|
|
27
|
+
if (index > -1) {
|
|
28
|
+
this.listeners.splice(index, 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
this.otherSubscriptions.forEach(function (sub) { return sub.unsubscribe(); });
|
|
32
|
+
this.unsubscribed = true;
|
|
33
|
+
};
|
|
34
|
+
return Subscription;
|
|
35
|
+
}());
|
|
38
36
|
exports.Subscription = Subscription;
|
|
39
37
|
// TODO: follow minimal basic spec: https://github.com/tc39/proposal-observable
|
|
40
38
|
var BehaviorSubject = /** @class */ (function () {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
BehaviorSubject.prototype.next = function (value) {
|
|
56
|
-
this.value = value;
|
|
57
|
-
for (var _i = 0, _a = this.listeners; _i < _a.length; _i++) {
|
|
58
|
-
var listener = _a[_i];
|
|
59
|
-
listener(value);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
// TODO: implement this as PIPE instead
|
|
63
|
-
BehaviorSubject.prototype.map = function (fn) {
|
|
64
|
-
var newSubject = new BehaviorSubject(fn(this.value));
|
|
65
|
-
// TODO: on destroy delete these
|
|
66
|
-
this.subscribe(function (val) {
|
|
67
|
-
newSubject.next(fn(val));
|
|
68
|
-
});
|
|
69
|
-
this.catch(function (err) {
|
|
70
|
-
newSubject.error(err);
|
|
71
|
-
});
|
|
72
|
-
return newSubject;
|
|
73
|
-
};
|
|
74
|
-
BehaviorSubject.prototype.catch = function (errorListener) {
|
|
75
|
-
this.errorListeners.push(errorListener);
|
|
76
|
-
return new Subscription(this.errorListeners, errorListener);
|
|
77
|
-
};
|
|
78
|
-
BehaviorSubject.prototype.error = function (error) {
|
|
79
|
-
for (var _i = 0, _a = this.errorListeners; _i < _a.length; _i++) {
|
|
80
|
-
var listener = _a[_i];
|
|
81
|
-
listener(error);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
BehaviorSubject.prototype.subscribe = function (listener, errorListener) {
|
|
85
|
-
this.listeners.push(listener);
|
|
86
|
-
if (errorListener) {
|
|
87
|
-
this.errorListeners.push(errorListener);
|
|
39
|
+
function BehaviorSubject(value) {
|
|
40
|
+
var _this = this;
|
|
41
|
+
this.value = value;
|
|
42
|
+
this.listeners = [];
|
|
43
|
+
this.errorListeners = [];
|
|
44
|
+
this.then = function () {
|
|
45
|
+
var _a;
|
|
46
|
+
var args = [];
|
|
47
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
48
|
+
args[_i] = arguments[_i];
|
|
49
|
+
}
|
|
50
|
+
return (_a = _this.toPromise()).then.apply(_a, args);
|
|
51
|
+
};
|
|
88
52
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var subscription = _this.subscribe(
|
|
95
|
-
function (value) {
|
|
96
|
-
resolve(value);
|
|
97
|
-
subscription.unsubscribe();
|
|
98
|
-
},
|
|
99
|
-
function (err) {
|
|
100
|
-
reject(err);
|
|
101
|
-
subscription.unsubscribe();
|
|
53
|
+
BehaviorSubject.prototype.next = function (value) {
|
|
54
|
+
this.value = value;
|
|
55
|
+
for (var _i = 0, _a = this.listeners; _i < _a.length; _i++) {
|
|
56
|
+
var listener = _a[_i];
|
|
57
|
+
listener(value);
|
|
102
58
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
})
|
|
59
|
+
};
|
|
60
|
+
// TODO: implement this as PIPE instead
|
|
61
|
+
BehaviorSubject.prototype.map = function (fn) {
|
|
62
|
+
var newSubject = new BehaviorSubject(fn(this.value));
|
|
63
|
+
// TODO: on destroy delete these
|
|
64
|
+
this.subscribe(function (val) {
|
|
65
|
+
newSubject.next(fn(val));
|
|
66
|
+
});
|
|
67
|
+
this.catch(function (err) {
|
|
68
|
+
newSubject.error(err);
|
|
69
|
+
});
|
|
70
|
+
return newSubject;
|
|
71
|
+
};
|
|
72
|
+
BehaviorSubject.prototype.catch = function (errorListener) {
|
|
73
|
+
this.errorListeners.push(errorListener);
|
|
74
|
+
return new Subscription(this.errorListeners, errorListener);
|
|
75
|
+
};
|
|
76
|
+
BehaviorSubject.prototype.error = function (error) {
|
|
77
|
+
for (var _i = 0, _a = this.errorListeners; _i < _a.length; _i++) {
|
|
78
|
+
var listener = _a[_i];
|
|
79
|
+
listener(error);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
BehaviorSubject.prototype.subscribe = function (listener, errorListener) {
|
|
83
|
+
this.listeners.push(listener);
|
|
84
|
+
if (errorListener) {
|
|
85
|
+
this.errorListeners.push(errorListener);
|
|
86
|
+
}
|
|
87
|
+
return new Subscription(this.listeners, listener);
|
|
88
|
+
};
|
|
89
|
+
BehaviorSubject.prototype.toPromise = function () {
|
|
90
|
+
var _this = this;
|
|
91
|
+
return new Promise(function (resolve, reject) {
|
|
92
|
+
var subscription = _this.subscribe(function (value) {
|
|
93
|
+
resolve(value);
|
|
94
|
+
subscription.unsubscribe();
|
|
95
|
+
}, function (err) {
|
|
96
|
+
reject(err);
|
|
97
|
+
subscription.unsubscribe();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
BehaviorSubject.prototype.promise = function () {
|
|
102
|
+
return this.toPromise();
|
|
103
|
+
};
|
|
104
|
+
return BehaviorSubject;
|
|
105
|
+
}());
|
|
111
106
|
exports.BehaviorSubject = BehaviorSubject;
|
|
112
107
|
// TODO: make different classes
|
|
113
108
|
exports.Observer = BehaviorSubject;
|
|
114
109
|
exports.Observable = BehaviorSubject;
|
|
115
|
-
//# sourceMappingURL=observable.class.js.map
|
|
110
|
+
//# sourceMappingURL=observable.class.js.map
|
|
@@ -1,166 +1,170 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TinyPromise = void 0;
|
|
4
|
-
var next_tick_function_1 = require(
|
|
4
|
+
var next_tick_function_1 = require("../functions/next-tick.function");
|
|
5
5
|
var State = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
Pending: 'Pending',
|
|
7
|
+
Fulfilled: 'Fulfilled',
|
|
8
|
+
Rejected: 'Rejected',
|
|
9
9
|
};
|
|
10
10
|
function isFunction(val) {
|
|
11
|
-
|
|
11
|
+
return val && typeof val === 'function';
|
|
12
12
|
}
|
|
13
13
|
function isObject(val) {
|
|
14
|
-
|
|
14
|
+
return val && typeof val === 'object';
|
|
15
15
|
}
|
|
16
16
|
var TinyPromise = /** @class */ (function () {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
TinyPromise.prototype._resolve = function (x) {
|
|
24
|
-
var _this = this;
|
|
25
|
-
if (x instanceof TinyPromise) {
|
|
26
|
-
x.then(this._resolve.bind(this), this._reject.bind(this));
|
|
27
|
-
} else if (isObject(x) || isFunction(x)) {
|
|
28
|
-
var called_1 = false;
|
|
29
|
-
try {
|
|
30
|
-
var thenable = x.then;
|
|
31
|
-
if (isFunction(thenable)) {
|
|
32
|
-
thenable.call(
|
|
33
|
-
x,
|
|
34
|
-
function (result) {
|
|
35
|
-
if (!called_1) _this._resolve(result);
|
|
36
|
-
called_1 = true;
|
|
37
|
-
return undefined;
|
|
38
|
-
},
|
|
39
|
-
function (error) {
|
|
40
|
-
if (!called_1) _this._reject(error);
|
|
41
|
-
called_1 = true;
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
} else {
|
|
46
|
-
this._fulfill(x);
|
|
47
|
-
}
|
|
48
|
-
} catch (ex) {
|
|
49
|
-
if (!called_1) {
|
|
50
|
-
this._reject(ex);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
this._fulfill(x);
|
|
17
|
+
function TinyPromise(executor) {
|
|
18
|
+
this._state = State.Pending;
|
|
19
|
+
this._handlers = [];
|
|
20
|
+
this._value = null;
|
|
21
|
+
executor(this._resolve.bind(this), this._reject.bind(this));
|
|
55
22
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return this._state === State.Fulfilled;
|
|
78
|
-
};
|
|
79
|
-
TinyPromise.prototype._isRejected = function () {
|
|
80
|
-
return this._state === State.Rejected;
|
|
81
|
-
};
|
|
82
|
-
TinyPromise.prototype._addHandler = function (onFulfilled, onRejected) {
|
|
83
|
-
this._handlers.push({
|
|
84
|
-
onFulfilled: onFulfilled,
|
|
85
|
-
onRejected: onRejected,
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
TinyPromise.prototype._callHandler = function (handler) {
|
|
89
|
-
if (this._isFulfilled() && isFunction(handler.onFulfilled)) {
|
|
90
|
-
handler.onFulfilled(this._value);
|
|
91
|
-
} else if (this._isRejected() && isFunction(handler.onRejected)) {
|
|
92
|
-
handler.onRejected(this._value);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
TinyPromise.prototype.then = function (onFulfilled, onRejected) {
|
|
96
|
-
var _this = this;
|
|
97
|
-
switch (this._state) {
|
|
98
|
-
case State.Pending: {
|
|
99
|
-
return new TinyPromise(function (resolve, reject) {
|
|
100
|
-
_this._addHandler(
|
|
101
|
-
function (value) {
|
|
102
|
-
(0, next_tick_function_1.nextTick)(function () {
|
|
103
|
-
try {
|
|
104
|
-
if (isFunction(onFulfilled)) {
|
|
105
|
-
resolve(onFulfilled(value));
|
|
106
|
-
} else {
|
|
107
|
-
resolve(value);
|
|
108
|
-
}
|
|
109
|
-
} catch (ex) {
|
|
110
|
-
reject(ex);
|
|
23
|
+
TinyPromise.prototype._resolve = function (x) {
|
|
24
|
+
var _this = this;
|
|
25
|
+
if (x instanceof TinyPromise) {
|
|
26
|
+
x.then(this._resolve.bind(this), this._reject.bind(this));
|
|
27
|
+
}
|
|
28
|
+
else if (isObject(x) || isFunction(x)) {
|
|
29
|
+
var called_1 = false;
|
|
30
|
+
try {
|
|
31
|
+
var thenable = x.then;
|
|
32
|
+
if (isFunction(thenable)) {
|
|
33
|
+
thenable.call(x, function (result) {
|
|
34
|
+
if (!called_1)
|
|
35
|
+
_this._resolve(result);
|
|
36
|
+
called_1 = true;
|
|
37
|
+
return undefined;
|
|
38
|
+
}, function (error) {
|
|
39
|
+
if (!called_1)
|
|
40
|
+
_this._reject(error);
|
|
41
|
+
called_1 = true;
|
|
42
|
+
return undefined;
|
|
43
|
+
});
|
|
111
44
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
function (error) {
|
|
115
|
-
(0, next_tick_function_1.nextTick)(function () {
|
|
116
|
-
try {
|
|
117
|
-
if (isFunction(onRejected)) {
|
|
118
|
-
resolve(onRejected(error));
|
|
119
|
-
} else {
|
|
120
|
-
reject(error);
|
|
121
|
-
}
|
|
122
|
-
} catch (ex) {
|
|
123
|
-
reject(ex);
|
|
45
|
+
else {
|
|
46
|
+
this._fulfill(x);
|
|
124
47
|
}
|
|
125
|
-
});
|
|
126
48
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return new TinyPromise(function (resolve, reject) {
|
|
132
|
-
(0, next_tick_function_1.nextTick)(function () {
|
|
133
|
-
try {
|
|
134
|
-
if (isFunction(onFulfilled)) {
|
|
135
|
-
resolve(onFulfilled(_this._value));
|
|
136
|
-
} else {
|
|
137
|
-
resolve(_this._value);
|
|
138
|
-
}
|
|
139
|
-
} catch (ex) {
|
|
140
|
-
reject(ex);
|
|
49
|
+
catch (ex) {
|
|
50
|
+
if (!called_1) {
|
|
51
|
+
this._reject(ex);
|
|
52
|
+
}
|
|
141
53
|
}
|
|
142
|
-
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this._fulfill(x);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
TinyPromise.prototype._fulfill = function (result) {
|
|
60
|
+
var _this = this;
|
|
61
|
+
this._state = State.Fulfilled;
|
|
62
|
+
this._value = result;
|
|
63
|
+
this._handlers.forEach(function (handler) { return _this._callHandler(handler); });
|
|
64
|
+
};
|
|
65
|
+
TinyPromise.prototype._reject = function (error) {
|
|
66
|
+
var _this = this;
|
|
67
|
+
this._state = State.Rejected;
|
|
68
|
+
this._value = error;
|
|
69
|
+
this._handlers.forEach(function (handler) { return _this._callHandler(handler); });
|
|
70
|
+
};
|
|
71
|
+
TinyPromise.prototype._isPending = function () {
|
|
72
|
+
return this._state === State.Pending;
|
|
73
|
+
};
|
|
74
|
+
TinyPromise.prototype._isFulfilled = function () {
|
|
75
|
+
return this._state === State.Fulfilled;
|
|
76
|
+
};
|
|
77
|
+
TinyPromise.prototype._isRejected = function () {
|
|
78
|
+
return this._state === State.Rejected;
|
|
79
|
+
};
|
|
80
|
+
TinyPromise.prototype._addHandler = function (onFulfilled, onRejected) {
|
|
81
|
+
this._handlers.push({
|
|
82
|
+
onFulfilled: onFulfilled,
|
|
83
|
+
onRejected: onRejected,
|
|
143
84
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
85
|
+
};
|
|
86
|
+
TinyPromise.prototype._callHandler = function (handler) {
|
|
87
|
+
if (this._isFulfilled() && isFunction(handler.onFulfilled)) {
|
|
88
|
+
handler.onFulfilled(this._value);
|
|
89
|
+
}
|
|
90
|
+
else if (this._isRejected() && isFunction(handler.onRejected)) {
|
|
91
|
+
handler.onRejected(this._value);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
TinyPromise.prototype.then = function (onFulfilled, onRejected) {
|
|
95
|
+
var _this = this;
|
|
96
|
+
switch (this._state) {
|
|
97
|
+
case State.Pending: {
|
|
98
|
+
return new TinyPromise(function (resolve, reject) {
|
|
99
|
+
_this._addHandler(function (value) {
|
|
100
|
+
(0, next_tick_function_1.nextTick)(function () {
|
|
101
|
+
try {
|
|
102
|
+
if (isFunction(onFulfilled)) {
|
|
103
|
+
resolve(onFulfilled(value));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
resolve(value);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (ex) {
|
|
110
|
+
reject(ex);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}, function (error) {
|
|
114
|
+
(0, next_tick_function_1.nextTick)(function () {
|
|
115
|
+
try {
|
|
116
|
+
if (isFunction(onRejected)) {
|
|
117
|
+
resolve(onRejected(error));
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
reject(error);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (ex) {
|
|
124
|
+
reject(ex);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
156
129
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
130
|
+
case State.Fulfilled: {
|
|
131
|
+
return new TinyPromise(function (resolve, reject) {
|
|
132
|
+
(0, next_tick_function_1.nextTick)(function () {
|
|
133
|
+
try {
|
|
134
|
+
if (isFunction(onFulfilled)) {
|
|
135
|
+
resolve(onFulfilled(_this._value));
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
resolve(_this._value);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (ex) {
|
|
142
|
+
reject(ex);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
case State.Rejected: {
|
|
148
|
+
return new TinyPromise(function (resolve, reject) {
|
|
149
|
+
(0, next_tick_function_1.nextTick)(function () {
|
|
150
|
+
try {
|
|
151
|
+
if (isFunction(onRejected)) {
|
|
152
|
+
resolve(onRejected(_this._value));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
reject(_this._value);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (ex) {
|
|
159
|
+
reject(ex);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return TinyPromise;
|
|
167
|
+
}());
|
|
164
168
|
exports.TinyPromise = TinyPromise;
|
|
165
|
-
exports.default = typeof Promise !== 'undefined' ? Promise : TinyPromise;
|
|
166
|
-
//# sourceMappingURL=promise.class.js.map
|
|
169
|
+
exports.default = (typeof Promise !== 'undefined' ? Promise : TinyPromise);
|
|
170
|
+
//# sourceMappingURL=promise.class.js.map
|