~sirn/fanboi2

ref: 5b482cfc1bfb0bb1e89715cb57c7bac864391768 fanboi2/assets/app/javascripts/utils/cancellable.ts -rw-r--r-- 368 bytes
5b482cfcKridsada Thanabulpong 0.30.0 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import {Error} from './errors';


export interface CancellableToken {
    cancel: (() => void);
}


export class Cancelled implements Error {
    public name = 'Cancelled';

    constructor(
        public message: string = 'Promise was explicitly aborted by the user.'
    ) {
    }
}


export class CancelToken implements CancellableToken {
    cancel(): void {}
};