Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit cc91561

Browse files
committed
chore: release 0.6.7
1 parent a8ea55d commit cc91561

File tree

6 files changed

+86
-3
lines changed

6 files changed

+86
-3
lines changed

dist/sync-test.js

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId])
10+
/******/ return installedModules[moduleId].exports;
11+
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ exports: {},
15+
/******/ id: moduleId,
16+
/******/ loaded: false
17+
/******/ };
18+
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
22+
/******/ // Flag the module as loaded
23+
/******/ module.loaded = true;
24+
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
29+
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
36+
/******/ // __webpack_public_path__
37+
/******/ __webpack_require__.p = "";
38+
39+
/******/ // Load entry module and return exports
40+
/******/ return __webpack_require__(0);
41+
/******/ })
42+
/************************************************************************/
43+
/******/ ([
44+
/* 0 */
45+
/***/ function(module, exports) {
46+
47+
(function () {
48+
var SyncTestZoneSpec = (function () {
49+
function SyncTestZoneSpec(namePrefix) {
50+
this.runZone = Zone.current;
51+
this.name = 'syncTestZone for ' + namePrefix;
52+
}
53+
SyncTestZoneSpec.prototype.onScheduleTask = function (delegate, current, target, task) {
54+
switch (task.type) {
55+
case 'microTask':
56+
case 'macroTask':
57+
throw new Error("Cannot call " + task.source + " from within a sync test.");
58+
case 'eventTask':
59+
task = delegate.scheduleTask(target, task);
60+
break;
61+
}
62+
return task;
63+
};
64+
return SyncTestZoneSpec;
65+
}());
66+
// Export the class so that new instances can be created with proper
67+
// constructor params.
68+
Zone['SyncTestZoneSpec'] = SyncTestZoneSpec;
69+
})();
70+
71+
72+
/***/ }
73+
/******/ ]);

dist/zone-node.js

+3
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
}
138138
};
139139
Zone.prototype.runTask = function (task, applyThis, applyArgs) {
140+
task.runCount++;
140141
if (task.zone != this)
141142
throw new Error('A task can only be run in the zone which created it! (Creation: ' +
142143
task.zone.name + '; Execution: ' + this.name + ')');
@@ -173,6 +174,7 @@
173174
};
174175
Zone.prototype.cancelTask = function (task) {
175176
var value = this._zoneDelegate.cancelTask(this, task);
177+
task.runCount = -1;
176178
task.cancelFn = null;
177179
return value;
178180
};
@@ -304,6 +306,7 @@
304306
}());
305307
var ZoneTask = (function () {
306308
function ZoneTask(type, zone, source, callback, options, scheduleFn, cancelFn) {
309+
this.runCount = 0;
307310
this.type = type;
308311
this.zone = zone;
309312
this.source = source;

dist/zone.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
var clearNative = utils_1.patchMethod(window, cancelName, function (delegate) { return function (self, args) {
115115
var task = args[0];
116116
if (task && typeof task.type == 'string') {
117-
if (task.cancelFn) {
117+
if (task.cancelFn && task.data.isPeriodic || task.runCount == 0) {
118118
// Do not cancel already canceled functions
119119
task.zone.cancelTask(task);
120120
}
@@ -225,6 +225,7 @@
225225
}
226226
};
227227
Zone.prototype.runTask = function (task, applyThis, applyArgs) {
228+
task.runCount++;
228229
if (task.zone != this)
229230
throw new Error('A task can only be run in the zone which created it! (Creation: ' +
230231
task.zone.name + '; Execution: ' + this.name + ')');
@@ -261,6 +262,7 @@
261262
};
262263
Zone.prototype.cancelTask = function (task) {
263264
var value = this._zoneDelegate.cancelTask(this, task);
265+
task.runCount = -1;
264266
task.cancelFn = null;
265267
return value;
266268
};
@@ -392,6 +394,7 @@
392394
}());
393395
var ZoneTask = (function () {
394396
function ZoneTask(type, zone, source, callback, options, scheduleFn, cancelFn) {
397+
this.runCount = 0;
395398
this.type = type;
396399
this.zone = zone;
397400
this.source = source;

dist/zone.js.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@ interface Task {
431431
* at the time of Task creation.
432432
*/
433433
zone: Zone;
434+
/**
435+
* Number of times the task has been executed, or -1 if canceled.
436+
*/
437+
runCount: number;
434438
}
435439
interface MicroTask extends Task {
436440
}

0 commit comments

Comments
 (0)