1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | Object.defineProperty(exports, "__esModule", { value: true });
|
9 | const cancellation_1 = require("./cancellation");
|
10 | const cancelable_1 = require("@esfx/cancelable");
|
11 | const utils_1 = require("./utils");
|
12 |
|
13 | function getToken(token) {
|
14 | if (utils_1.isMissing(token))
|
15 | token = cancellation_1.CancellationToken.none;
|
16 | if (!utils_1.isInstance(token, cancellation_1.CancellationToken) && !cancelable_1.Cancelable.hasInstance(token))
|
17 | throw new TypeError("CancellationToken expected: token.");
|
18 | return cancellation_1.CancellationToken.from(token);
|
19 | }
|
20 | exports.getToken = getToken;
|