@angular-wave/angular.ts 0.0.51 → 0.0.52
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/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/animate-children-directive.js +19 -99
- package/src/animations/animate-children-directive.md +80 -0
- package/src/animations/animate-css-driver.js +250 -256
- package/src/animations/animate-css.js +646 -875
- package/src/animations/animate-css.md +263 -0
- package/src/animations/animate-js-driver.js +54 -56
- package/src/animations/animate-js.js +303 -306
- package/src/animations/animate-queue.js +707 -716
- package/src/animations/animate-swap.js +30 -119
- package/src/animations/animate-swap.md +88 -0
- package/src/animations/animation.js +3 -3
- package/src/core/animate/animate-runner.js +147 -145
- package/src/core/animate/animate.js +568 -582
- package/src/core/animate/anomate.md +13 -0
- package/src/core/compile/compile.spec.js +5 -6
- package/src/core/core.html +0 -1
- package/src/directive/select/select.js +301 -305
- package/src/public.js +0 -1
- package/src/router/directives/state-directives.js +256 -574
- package/src/router/directives/state-directives.md +435 -0
- package/src/router/directives/view-directive.js +3 -3
- package/src/router/index.js +7 -7
- package/types/animations/animate-children-directive.d.ts +5 -80
- package/types/animations/animate-css-driver.d.ts +11 -0
- package/types/animations/animate-css.d.ts +8 -0
- package/types/animations/animate-js-driver.d.ts +8 -0
- package/types/animations/animate-js.d.ts +12 -0
- package/types/animations/animate-queue.d.ts +19 -0
- package/types/animations/animate-swap.d.ts +5 -89
- package/types/core/animate/animate-runner.d.ts +32 -0
- package/types/core/animate/animate.d.ts +509 -0
- package/types/directive/select/select.d.ts +79 -0
- package/types/router/directives/state-directives.d.ts +31 -0
- package/src/core/document.spec.js +0 -52
|
@@ -1,119 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* </div>
|
|
32
|
-
* </file>
|
|
33
|
-
* <file name="script.js">
|
|
34
|
-
* angular.module('ngAnimateSwapExample', ['ngAnimate'])
|
|
35
|
-
* .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) {
|
|
36
|
-
* $scope.number = 0;
|
|
37
|
-
* $interval(function() {
|
|
38
|
-
* $scope.number++;
|
|
39
|
-
* }, 1000);
|
|
40
|
-
*
|
|
41
|
-
* let colors = ['red','blue','green','yellow','orange'];
|
|
42
|
-
* $scope.colorClass = function(number) {
|
|
43
|
-
* return colors[number % colors.length];
|
|
44
|
-
* };
|
|
45
|
-
* }]);
|
|
46
|
-
* </file>
|
|
47
|
-
* <file name="animations.css">
|
|
48
|
-
* .container {
|
|
49
|
-
* height:250px;
|
|
50
|
-
* width:250px;
|
|
51
|
-
* position:relative;
|
|
52
|
-
* overflow:hidden;
|
|
53
|
-
* border:2px solid black;
|
|
54
|
-
* }
|
|
55
|
-
* .container .cell {
|
|
56
|
-
* font-size:150px;
|
|
57
|
-
* text-align:center;
|
|
58
|
-
* line-height:250px;
|
|
59
|
-
* position:absolute;
|
|
60
|
-
* top:0;
|
|
61
|
-
* left:0;
|
|
62
|
-
* right:0;
|
|
63
|
-
* border-bottom:2px solid black;
|
|
64
|
-
* }
|
|
65
|
-
* .swap-animation.ng-enter, .swap-animation.ng-leave {
|
|
66
|
-
* transition:0.5s linear all;
|
|
67
|
-
* }
|
|
68
|
-
* .swap-animation.ng-enter {
|
|
69
|
-
* top:-250px;
|
|
70
|
-
* }
|
|
71
|
-
* .swap-animation.ng-enter-active {
|
|
72
|
-
* top:0px;
|
|
73
|
-
* }
|
|
74
|
-
* .swap-animation.ng-leave {
|
|
75
|
-
* top:0px;
|
|
76
|
-
* }
|
|
77
|
-
* .swap-animation.ng-leave-active {
|
|
78
|
-
* top:250px;
|
|
79
|
-
* }
|
|
80
|
-
* .red { background:red; }
|
|
81
|
-
* .green { background:green; }
|
|
82
|
-
* .blue { background:blue; }
|
|
83
|
-
* .yellow { background:yellow; }
|
|
84
|
-
* .orange { background:orange; }
|
|
85
|
-
* </file>
|
|
86
|
-
* </example>
|
|
87
|
-
*/
|
|
88
|
-
export const ngAnimateSwapDirective = [
|
|
89
|
-
"$animate",
|
|
90
|
-
function ($animate) {
|
|
91
|
-
return {
|
|
92
|
-
restrict: "A",
|
|
93
|
-
transclude: "element",
|
|
94
|
-
terminal: true,
|
|
95
|
-
priority: 550, // We use 550 here to ensure that the directive is caught before others,
|
|
96
|
-
// but after `ngIf` (at priority 600).
|
|
97
|
-
link(scope, $element, attrs, ctrl, $transclude) {
|
|
98
|
-
let previousElement;
|
|
99
|
-
let previousScope;
|
|
100
|
-
scope.$watchCollection(attrs.ngAnimateSwap || attrs.for, (value) => {
|
|
101
|
-
if (previousElement) {
|
|
102
|
-
$animate.leave(previousElement);
|
|
103
|
-
}
|
|
104
|
-
if (previousScope) {
|
|
105
|
-
previousScope.$destroy();
|
|
106
|
-
previousScope = null;
|
|
107
|
-
}
|
|
108
|
-
if (value || value === 0) {
|
|
109
|
-
$transclude((clone, childScope) => {
|
|
110
|
-
previousElement = clone;
|
|
111
|
-
previousScope = childScope;
|
|
112
|
-
$animate.enter(clone, null, $element);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
},
|
|
119
|
-
];
|
|
1
|
+
ngAnimateSwapDirective.$inject = ["$animate"];
|
|
2
|
+
export function ngAnimateSwapDirective($animate) {
|
|
3
|
+
return {
|
|
4
|
+
restrict: "A",
|
|
5
|
+
transclude: "element",
|
|
6
|
+
terminal: true,
|
|
7
|
+
priority: 550, // We use 550 here to ensure that the directive is caught before others,
|
|
8
|
+
// but after `ngIf` (at priority 600).
|
|
9
|
+
link(scope, $element, attrs, ctrl, $transclude) {
|
|
10
|
+
let previousElement;
|
|
11
|
+
let previousScope;
|
|
12
|
+
scope.$watchCollection(attrs.ngAnimateSwap || attrs.for, (value) => {
|
|
13
|
+
if (previousElement) {
|
|
14
|
+
$animate.leave(previousElement);
|
|
15
|
+
}
|
|
16
|
+
if (previousScope) {
|
|
17
|
+
previousScope.$destroy();
|
|
18
|
+
previousScope = null;
|
|
19
|
+
}
|
|
20
|
+
if (value || value === 0) {
|
|
21
|
+
$transclude((clone, childScope) => {
|
|
22
|
+
previousElement = clone;
|
|
23
|
+
previousScope = childScope;
|
|
24
|
+
$animate.enter(clone, null, $element);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/\*\*
|
|
2
|
+
|
|
3
|
+
- @ngdoc directive
|
|
4
|
+
- @name ngAnimateSwap
|
|
5
|
+
- @restrict A
|
|
6
|
+
- @scope
|
|
7
|
+
-
|
|
8
|
+
- @description
|
|
9
|
+
-
|
|
10
|
+
- ngAnimateSwap is a animation-oriented directive that allows for the container to
|
|
11
|
+
- be removed and entered in whenever the associated expression changes. A
|
|
12
|
+
- common usecase for this directive is a rotating banner or slider component which
|
|
13
|
+
- contains one image being present at a time. When the active image changes
|
|
14
|
+
- then the old image will perform a `leave` animation and the new element
|
|
15
|
+
- will be inserted via an `enter` animation.
|
|
16
|
+
-
|
|
17
|
+
- @animations
|
|
18
|
+
- | Animation | Occurs |
|
|
19
|
+
- |----------------------------------|--------------------------------------|
|
|
20
|
+
- | {@link ng.$animate#enter enter} | when the new element is inserted to the DOM |
|
|
21
|
+
- | {@link ng.$animate#leave leave} | when the old element is removed from the DOM |
|
|
22
|
+
-
|
|
23
|
+
- @example
|
|
24
|
+
- <example name="ngAnimateSwap-directive" module="ngAnimateSwapExample"
|
|
25
|
+
- deps="angular-animate.js"
|
|
26
|
+
- animations="true" fixBase="true">
|
|
27
|
+
- <file name="index.html">
|
|
28
|
+
- <div class="container" ng-controller="AppCtrl">
|
|
29
|
+
- <div ng-animate-swap="number" class="cell swap-animation" ng-class="colorClass(number)">
|
|
30
|
+
- {{ number }}
|
|
31
|
+
- </div>
|
|
32
|
+
- </div>
|
|
33
|
+
- </file>
|
|
34
|
+
- <file name="script.js">
|
|
35
|
+
- angular.module('ngAnimateSwapExample', ['ngAnimate'])
|
|
36
|
+
- .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) {
|
|
37
|
+
- $scope.number = 0;
|
|
38
|
+
- $interval(function() {
|
|
39
|
+
- $scope.number++;
|
|
40
|
+
- }, 1000);
|
|
41
|
+
-
|
|
42
|
+
- let colors = ['red','blue','green','yellow','orange'];
|
|
43
|
+
- $scope.colorClass = function(number) {
|
|
44
|
+
- return colors[number % colors.length];
|
|
45
|
+
- };
|
|
46
|
+
- }]);
|
|
47
|
+
- </file>
|
|
48
|
+
- <file name="animations.css">
|
|
49
|
+
- .container {
|
|
50
|
+
- height:250px;
|
|
51
|
+
- width:250px;
|
|
52
|
+
- position:relative;
|
|
53
|
+
- overflow:hidden;
|
|
54
|
+
- border:2px solid black;
|
|
55
|
+
- }
|
|
56
|
+
- .container .cell {
|
|
57
|
+
- font-size:150px;
|
|
58
|
+
- text-align:center;
|
|
59
|
+
- line-height:250px;
|
|
60
|
+
- position:absolute;
|
|
61
|
+
- top:0;
|
|
62
|
+
- left:0;
|
|
63
|
+
- right:0;
|
|
64
|
+
- border-bottom:2px solid black;
|
|
65
|
+
- }
|
|
66
|
+
- .swap-animation.ng-enter, .swap-animation.ng-leave {
|
|
67
|
+
- transition:0.5s linear all;
|
|
68
|
+
- }
|
|
69
|
+
- .swap-animation.ng-enter {
|
|
70
|
+
- top:-250px;
|
|
71
|
+
- }
|
|
72
|
+
- .swap-animation.ng-enter-active {
|
|
73
|
+
- top:0px;
|
|
74
|
+
- }
|
|
75
|
+
- .swap-animation.ng-leave {
|
|
76
|
+
- top:0px;
|
|
77
|
+
- }
|
|
78
|
+
- .swap-animation.ng-leave-active {
|
|
79
|
+
- top:250px;
|
|
80
|
+
- }
|
|
81
|
+
- .red { background:red; }
|
|
82
|
+
- .green { background:green; }
|
|
83
|
+
- .blue { background:blue; }
|
|
84
|
+
- .yellow { background:yellow; }
|
|
85
|
+
- .orange { background:orange; }
|
|
86
|
+
- </file>
|
|
87
|
+
- </example>
|
|
88
|
+
*/
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
prepareAnimationOptions,
|
|
10
10
|
} from "./shared";
|
|
11
11
|
|
|
12
|
+
const RUNNER_STORAGE_KEY = "$$animationRunner";
|
|
13
|
+
const PREPARE_CLASSES_KEY = "$$animatePrepareClasses";
|
|
14
|
+
|
|
12
15
|
export function $$AnimationProvider() {
|
|
13
16
|
const NG_ANIMATE_REF_ATTR = "ng-animate-ref";
|
|
14
17
|
|
|
15
18
|
const drivers = (this.drivers = []);
|
|
16
19
|
|
|
17
|
-
const RUNNER_STORAGE_KEY = "$$animationRunner";
|
|
18
|
-
const PREPARE_CLASSES_KEY = "$$animatePrepareClasses";
|
|
19
|
-
|
|
20
20
|
function setRunner(element, runner) {
|
|
21
21
|
element.data(RUNNER_STORAGE_KEY, runner);
|
|
22
22
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { forEach } from "../../shared/utils";
|
|
2
|
-
|
|
3
1
|
export function AnimateAsyncRunFactoryProvider() {
|
|
4
2
|
this.$get = [
|
|
5
3
|
function () {
|
|
@@ -33,163 +31,167 @@ export function AnimateAsyncRunFactoryProvider() {
|
|
|
33
31
|
];
|
|
34
32
|
}
|
|
35
33
|
|
|
34
|
+
const INITIAL_STATE = 0;
|
|
35
|
+
const DONE_PENDING_STATE = 1;
|
|
36
|
+
const DONE_COMPLETE_STATE = 2;
|
|
37
|
+
let $q, $$animateAsyncRun, $timeout;
|
|
38
|
+
|
|
36
39
|
export function AnimateRunnerFactoryProvider() {
|
|
37
40
|
this.$get = [
|
|
38
41
|
"$q",
|
|
39
42
|
"$$animateAsyncRun",
|
|
40
|
-
"$$isDocumentHidden",
|
|
41
43
|
"$timeout",
|
|
42
|
-
function (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
function (q, animateAsyncRun, timeout) {
|
|
45
|
+
$q = q;
|
|
46
|
+
$$animateAsyncRun = animateAsyncRun;
|
|
47
|
+
$timeout = timeout;
|
|
48
|
+
return AnimateRunner;
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
class AnimateRunner {
|
|
54
|
+
static chain(chain, callback) {
|
|
55
|
+
let index = 0;
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
57
|
+
function next() {
|
|
58
|
+
if (index === chain.length) {
|
|
59
|
+
callback(true);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
index++;
|
|
63
|
-
next();
|
|
64
|
-
});
|
|
63
|
+
chain[index]((response) => {
|
|
64
|
+
if (response === false) {
|
|
65
|
+
callback(false);
|
|
66
|
+
return;
|
|
65
67
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
let status = true;
|
|
71
|
-
forEach(runners, (runner) => {
|
|
72
|
-
runner.done(onProgress);
|
|
73
|
-
});
|
|
68
|
+
index++;
|
|
69
|
+
next();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (++count === runners.length) {
|
|
78
|
-
callback(status);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
73
|
+
next();
|
|
74
|
+
}
|
|
82
75
|
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
static all(runners, callback) {
|
|
77
|
+
let count = 0;
|
|
78
|
+
let status = true;
|
|
85
79
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
80
|
+
runners.forEach((runner) => {
|
|
81
|
+
runner.done(onProgress);
|
|
82
|
+
});
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
} else {
|
|
96
|
-
rafTick(fn);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
this._state = 0;
|
|
84
|
+
function onProgress(response) {
|
|
85
|
+
status = status && response;
|
|
86
|
+
if (++count === runners.length) {
|
|
87
|
+
callback(status);
|
|
100
88
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
constructor(host) {
|
|
93
|
+
this.setHost(host);
|
|
94
|
+
|
|
95
|
+
const rafTick = $$animateAsyncRun();
|
|
96
|
+
const timeoutTick = (fn) => {
|
|
97
|
+
$timeout(fn, 0, false);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
this._doneCallbacks = [];
|
|
101
|
+
this._tick = (fn) => {
|
|
102
|
+
if (document.hidden) {
|
|
103
|
+
timeoutTick(fn);
|
|
104
|
+
} else {
|
|
105
|
+
rafTick(fn);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
this._state = 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
setHost(host) {
|
|
112
|
+
this.host = host || {};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
done(fn) {
|
|
116
|
+
if (this._state === DONE_COMPLETE_STATE) {
|
|
117
|
+
fn();
|
|
118
|
+
} else {
|
|
119
|
+
this._doneCallbacks.push(fn);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
progress() {}
|
|
124
|
+
|
|
125
|
+
getPromise() {
|
|
126
|
+
if (!this.promise) {
|
|
127
|
+
const self = this;
|
|
128
|
+
this.promise = $q((resolve, reject) => {
|
|
129
|
+
self.done((status) => {
|
|
130
|
+
if (status === false) {
|
|
131
|
+
reject();
|
|
110
132
|
} else {
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
progress: () => {},
|
|
116
|
-
|
|
117
|
-
getPromise() {
|
|
118
|
-
if (!this.promise) {
|
|
119
|
-
const self = this;
|
|
120
|
-
this.promise = $q((resolve, reject) => {
|
|
121
|
-
self.done((status) => {
|
|
122
|
-
if (status === false) {
|
|
123
|
-
reject();
|
|
124
|
-
} else {
|
|
125
|
-
resolve();
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return this.promise;
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
then(resolveHandler, rejectHandler) {
|
|
134
|
-
return this.getPromise().then(resolveHandler, rejectHandler);
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
catch(handler) {
|
|
138
|
-
return this.getPromise().catch(handler);
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
finally(handler) {
|
|
142
|
-
return this.getPromise().finally(handler);
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
pause() {
|
|
146
|
-
if (this.host.pause) {
|
|
147
|
-
this.host.pause();
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
resume() {
|
|
152
|
-
if (this.host.resume) {
|
|
153
|
-
this.host.resume();
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
end() {
|
|
158
|
-
if (this.host.end) {
|
|
159
|
-
this.host.end();
|
|
133
|
+
resolve();
|
|
160
134
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return this.promise;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
then(resolveHandler, rejectHandler) {
|
|
142
|
+
return this.getPromise().then(resolveHandler, rejectHandler);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
catch(handler) {
|
|
146
|
+
return this.getPromise().catch(handler);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
finally(handler) {
|
|
150
|
+
return this.getPromise().finally(handler);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
pause() {
|
|
154
|
+
if (this.host.pause) {
|
|
155
|
+
this.host.pause();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
resume() {
|
|
160
|
+
if (this.host.resume) {
|
|
161
|
+
this.host.resume();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
end() {
|
|
166
|
+
if (this.host.end) {
|
|
167
|
+
this.host.end();
|
|
168
|
+
}
|
|
169
|
+
this._resolve(true);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
cancel() {
|
|
173
|
+
if (this.host.cancel) {
|
|
174
|
+
this.host.cancel();
|
|
175
|
+
}
|
|
176
|
+
this._resolve(false);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
complete(response) {
|
|
180
|
+
if (this._state === INITIAL_STATE) {
|
|
181
|
+
this._state = DONE_PENDING_STATE;
|
|
182
|
+
this._tick(() => {
|
|
183
|
+
this._resolve(response);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
_resolve(response) {
|
|
189
|
+
if (this._state !== DONE_COMPLETE_STATE) {
|
|
190
|
+
this._doneCallbacks.forEach((fn) => {
|
|
191
|
+
fn(response);
|
|
192
|
+
});
|
|
193
|
+
this._doneCallbacks.length = 0;
|
|
194
|
+
this._state = DONE_COMPLETE_STATE;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
195
197
|
}
|