Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit 68d916a

Browse files
refactor(service): rename que to queue
1 parent 7b07ae3 commit 68d916a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/local-update-service.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,32 @@ import { LocalForageToken } from './localforage';
1111
@Injectable()
1212
export class LocalUpdateService {
1313
cache = {};
14-
que: LocalUpdateQue = {};
14+
queue: LocalUpdateQueue = {};
1515
constructor(@Inject(LocalForageToken) private localForage: any) { }
1616
update(key, valueFunction) {
1717
return new Promise(resolve => {
18-
if (!(key in this.que)) {
19-
this.que[key] = {
18+
if (!(key in this.queue)) {
19+
this.queue[key] = {
2020
running: false,
2121
updates: [],
2222
};
2323
}
24-
this.que[key].updates.push({
24+
this.queue[key].updates.push({
2525
function: valueFunction,
2626
resolve: resolve
2727
});
28-
if (!this.que[key].running) {
29-
this.que[key].running = true;
28+
if (!this.queue[key].running) {
29+
this.queue[key].running = true;
3030
this.updateNext(key);
3131
}
3232
});
3333
}
3434
private updateNext(key: string) {
35-
if (this.que[key].updates.length === 0) {
36-
this.que[key].running = false;
35+
if (this.queue[key].updates.length === 0) {
36+
this.queue[key].running = false;
3737
return;
3838
}
39-
const nextUpdate: LocalUpdate = this.que[key].updates.pop();
39+
const nextUpdate: LocalUpdate = this.queue[key].updates.pop();
4040
return new Promise(resolve => this.checkCache(key)
4141
.then(() => this.updateValue(key, nextUpdate)
4242
.then(() => this.updateNext(key))));
@@ -65,7 +65,7 @@ export class LocalUpdateService {
6565
}
6666
}
6767

68-
export interface LocalUpdateQue {
68+
export interface LocalUpdateQueue {
6969
[key: string]: {
7070
running: boolean;
7171
updates: LocalUpdate[];

0 commit comments

Comments
 (0)