Skip to content

Commit 941520d

Browse files
committed
remove deprecated deferOnce, defer and setTimeout
1 parent 838c462 commit 941520d

9 files changed

+19
-43
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-25
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,6 @@ export default class Backburner {
236236
return this._join(target, method, args);
237237
}
238238

239-
/**
240-
* @deprecated please use schedule instead.
241-
*/
242-
public defer(queueName: string, ...args);
243-
public defer() {
244-
return this.schedule(...arguments);
245-
}
246-
247239
/**
248240
* Schedule the passed function to run inside the specified queue.
249241
*/
@@ -270,14 +262,6 @@ export default class Backburner {
270262
return this._ensureInstance().schedule(queueName, null, iteratorDrain, [iterable], false, stack);
271263
}
272264

273-
/**
274-
* @deprecated please use scheduleOnce instead.
275-
*/
276-
public deferOnce(queueName: string, ...args);
277-
public deferOnce() {
278-
return this.scheduleOnce(...arguments);
279-
}
280-
281265
/**
282266
* Schedule the passed function to run once inside the specified queue.
283267
*/
@@ -291,14 +275,6 @@ export default class Backburner {
291275
return this._ensureInstance().schedule(queueName, target, method, args, true, stack);
292276
}
293277

294-
/**
295-
* @deprecated use later instead.
296-
*/
297-
public setTimeout(...args);
298-
public setTimeout() {
299-
return this.later(...arguments);
300-
}
301-
302278
public later()
303279
public later(...args) {
304280
let length = args.length;
@@ -489,7 +465,7 @@ export default class Backburner {
489465
return this._cancelItem(timer, this._throttlers) || this._cancelItem(timer, this._debouncees);
490466
} else if (timerType === 'function') { // we're cancelling a setTimeout
491467
return this._cancelLaterTimer(timer);
492-
} else if (timerType === 'object' && timer.queue && timer.method) { // we're cancelling a deferOnce
468+
} else if (timerType === 'object' && timer.queue && timer.method) { // we're cancelling a scheduleOnce
493469
return timer.queue.cancel(timer);
494470
}
495471

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
@@ -3,7 +3,7 @@ import Backburner from 'backburner';
33
const originalDateNow = Date.now;
44
const originalDateValueOf = Date.prototype.valueOf;
55

6-
QUnit.module('tests/set-timeout-test', {
6+
QUnit.module('tests/later-test', {
77
afterEach() {
88
Date.now = originalDateNow;
99
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)