Skip to content

Commit 9e0aa8e

Browse files
committed
remove deprecated deferOnce, defer and setTimeout
1 parent fd24f18 commit 9e0aa8e

9 files changed

+19
-41
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-23
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,6 @@ export default class Backburner {
234234
return this._join(target, method, args);
235235
}
236236

237-
/**
238-
* @deprecated please use schedule instead.
239-
*/
240-
public defer(queueName, targetOrMethod, ..._args) {
241-
return this.schedule(queueName, targetOrMethod, ..._args);
242-
}
243-
244237
/**
245238
* Schedule the passed function to run inside the specified queue.
246239
*/
@@ -266,13 +259,6 @@ export default class Backburner {
266259
return this._ensureInstance().schedule(queueName, null, iteratorDrain, [iterable], false, stack);
267260
}
268261

269-
/**
270-
* @deprecated please use scheduleOnce instead.
271-
*/
272-
public deferOnce(queueName, targetOrMethod, ...args) {
273-
return this.scheduleOnce(queueName, targetOrMethod, ...args);
274-
}
275-
276262
/**
277263
* Schedule the passed function to run once inside the specified queue.
278264
*/
@@ -285,14 +271,6 @@ export default class Backburner {
285271
return this._ensureInstance().schedule(queueName, target, method, args, true, stack);
286272
}
287273

288-
/**
289-
* @deprecated use later instead.
290-
*/
291-
public setTimeout(...args);
292-
public setTimeout() {
293-
return this.later(...arguments);
294-
}
295-
296274
public later(...args) {
297275
let length = args.length;
298276

@@ -552,7 +530,7 @@ export default class Backburner {
552530
return this._cancelItem(timer, this._throttlers) || this._cancelItem(timer, this._debouncees);
553531
} else if (timerType === 'function') { // we're cancelling a setTimeout
554532
return this._cancelLaterTimer(timer);
555-
} else if (timerType === 'object' && timer.queue && timer.method) { // we're cancelling a deferOnce
533+
} else if (timerType === 'object' && timer.queue && timer.method) { // we're cancelling a scheduleOnce
556534
return timer.queue.cancel(timer);
557535
}
558536

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
@@ -39,7 +39,7 @@ QUnit.test('We can use a custom setTimeout', function(assert) {
3939
}
4040
});
4141

42-
bb.setTimeout(() => {
42+
bb.later(() => {
4343
assert.ok(bb.options._platform.isFakePlatform, 'we are using the fake platform');
4444
assert.ok(customNextWasUsed , 'custom later was used');
4545
done();

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-test', {
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)