Skip to content

Commit 67cc051

Browse files
committedMay 22, 2018
remove deprecated deferOnce, defer and setTimeout
1 parent 43c153d commit 67cc051

9 files changed

+19
-44
lines changed
 

‎README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ A priority queue that will efficiently batch, order, reorder and process work; d
1818

1919
`Backburner#run` - execute the passed function and flush any deferred actions
2020

21-
`Backburner#defer` - defer the passed function to run inside the specified queue
21+
`Backburner#schedule` - defer the passed function to run inside the specified queue
2222

23-
`Backburner#deferOnce` - defer the passed function to run inside the specified queue, only execute it once
23+
`Backburner#scheduleOnce` - defer the passed function to run inside the specified queue, only execute it once
2424

25-
`Backburner#setTimeout` - execute the passed function in a specified amount of time
25+
`Backburner#later` - execute the passed function in a specified amount of time
2626

2727
`Backburner#debounce` - execute the passed function in a specified amount of time, reset timer upon additional calls
2828

2929
`Backburner#throttle` - rate-limit the passed function for a specified amount of time
3030

31-
`Backburner#cancel` - cancel a `deferOnce`, `setTimeout`, `debounce` or `throttle`
31+
`Backburner#cancel` - cancel a `scheduleOnce`, `later`, `debounce` or `throttle`
3232

3333
`Backburner#on` - Add an event callback. Supports the following events:
3434

‎lib/index.ts

+1-26
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,6 @@ export default class Backburner {
342342
return this._join(target, method, args);
343343
}
344344

345-
/**
346-
* @deprecated please use schedule instead.
347-
*/
348-
public defer(queueName, target, method, ...args) {
349-
deferCount++;
350-
return this.schedule(queueName, target, method, ...args);
351-
}
352-
353345
/**
354346
* Schedule the passed function to run inside the specified queue.
355347
*/
@@ -377,14 +369,6 @@ export default class Backburner {
377369
return this._ensureInstance().schedule(queueName, null, iteratorDrain, [iterable], false, stack);
378370
}
379371

380-
/**
381-
* @deprecated please use scheduleOnce instead.
382-
*/
383-
public deferOnce(queueName, target, method, ...args) {
384-
deferOnceCount++;
385-
return this.scheduleOnce(queueName, target, method, ...args);
386-
}
387-
388372
/**
389373
* Schedule the passed function to run once inside the specified queue.
390374
*/
@@ -398,15 +382,6 @@ export default class Backburner {
398382
return this._ensureInstance().schedule(queueName, target, method, args, true, stack);
399383
}
400384

401-
/**
402-
* @deprecated use later instead.
403-
*/
404-
public setTimeout(...args);
405-
public setTimeout() {
406-
setTimeoutCount++;
407-
return this.later(...arguments);
408-
}
409-
410385
public later<T>(...args: any[]): Timer; // fixes `this.later(...arguments)` usage in `setTimeout`
411386
public later<T>(target: T, methodName: keyof T, wait?: number | string): Timer;
412387
public later<T>(target: T, methodName: keyof T, arg1: any, wait?: number | string): Timer;
@@ -554,7 +529,7 @@ export default class Backburner {
554529
return this._cancelItem(timer, this._throttlers) || this._cancelItem(timer, this._debouncees);
555530
} else if (timerType === 'string') { // we're cancelling a setTimeout
556531
return this._cancelLaterTimer(timer);
557-
} else if (timerType === 'object' && timer.queue && timer.method) { // we're cancelling a deferOnce
532+
} else if (timerType === 'object' && timer.queue && timer.method) { // we're cancelling a scheduleOnce
558533
return timer.queue.cancel(timer);
559534
}
560535

‎tests/cancel-test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ QUnit.test('scheduleOnce', function(assert) {
1818
});
1919
});
2020

21-
QUnit.test('setTimeout', function(assert) {
21+
QUnit.test('later', function(assert) {
2222
assert.expect(5);
2323
let done = assert.async();
2424

@@ -43,7 +43,7 @@ QUnit.test('setTimeout', function(assert) {
4343
}, 0);
4444
});
4545

46-
QUnit.test('setTimeout with multiple pending', function(assert) {
46+
QUnit.test('later with multiple pending', function(assert) {
4747
assert.expect(7);
4848

4949
let done = assert.async();
@@ -73,7 +73,7 @@ QUnit.test('setTimeout with multiple pending', function(assert) {
7373
}, 10);
7474
});
7575

76-
QUnit.test('setTimeout and creating a new later', function(assert) {
76+
QUnit.test('later and creating a new later', function(assert) {
7777
assert.expect(7);
7878
let done = assert.async();
7979
let called = false;

‎tests/configurable-timeout-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ QUnit.test('We can use a custom setTimeout', function(assert) {
4343
}
4444
});
4545

46-
bb.setTimeout(() => {
46+
bb.later(() => {
4747
assert.ok(customNextWasUsed , 'custom later was used');
4848
done();
4949
});

‎tests/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import './cancel-test';
44
import './configurable-timeout-test';
55
import './debounce-test';
66
import './debug-test';
7-
import './defer-iterable-test';
8-
import './defer-once-test';
9-
import './defer-test';
107
import './events-test';
118
import './join-test';
9+
import './later-test';
1210
import './multi-turn-test';
1311
import './queue-push-unique-test';
1412
import './queue-test';
1513
import './run-test';
16-
import './set-timeout-test';
14+
import './schedule-iterable-test';
15+
import './schedule-once-test';
16+
import './schedule-test';
1717
import './throttle-test';

‎tests/set-timeout-test.ts ‎tests/later-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Backburner from 'backburner';
44
const originalDateNow = Date.now;
55
const originalDateValueOf = Date.prototype.valueOf;
66

7-
QUnit.module('tests/set-timeout-test', {
7+
QUnit.module('tests/later', {
88
afterEach() {
99
Date.now = originalDateNow;
1010
Date.prototype.valueOf = originalDateValueOf;

‎tests/defer-iterable-test.ts ‎tests/schedule-iterable-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Backburner from 'backburner';
22

3-
QUnit.module('tests/defer-iterable');
3+
QUnit.module('tests/schedule-iterable');
44

55
class Iterator {
66
private _collection: Function[];

‎tests/defer-once-test.ts ‎tests/schedule-once-test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Backburner from 'backburner';
22

3-
QUnit.module('tests/defer-once');
3+
QUnit.module('tests/schedule-once');
44

55
QUnit.test('when passed a function', function(assert) {
66
assert.expect(1);
@@ -76,7 +76,7 @@ QUnit.test('throws when passed an undefined method', function(assert) {
7676
onError
7777
});
7878

79-
bb.run(() => bb.deferOnce('deferErrors', {zomg: 'hi'}, undefined));
79+
bb.run(() => bb.scheduleOnce('deferErrors', {zomg: 'hi'}, undefined));
8080
});
8181

8282
QUnit.test('throws when passed an method name that does not exists on the target', function(assert) {
@@ -90,7 +90,7 @@ QUnit.test('throws when passed an method name that does not exists on the target
9090
onError
9191
});
9292

93-
bb.run(() => bb.deferOnce('deferErrors', {zomg: 'hi'}, 'checkFunction'));
93+
bb.run(() => bb.scheduleOnce('deferErrors', {zomg: 'hi'}, 'checkFunction'));
9494
});
9595

9696
QUnit.test('when passed a target, method, and arguments', function(assert) {

‎tests/defer-test.ts ‎tests/schedule-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Backburner from 'backburner';
22
let originalDateValueOf = Date.prototype.valueOf;
33

4-
QUnit.module('tests/defer', {
4+
QUnit.module('tests/schedule', {
55
afterEach() {
66
Date.prototype.valueOf = originalDateValueOf;
77
}

0 commit comments

Comments
 (0)