@soundworks/core 4.0.0-alpha.2 → 4.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +0,0 @@
1
- import { idGenerator } from './utils.js';
2
-
3
- const generateRequestId = idGenerator();
4
- const requestPromises = new Map();
5
-
6
- export function storeRequestPromise(resolve, reject) {
7
- const reqId = generateRequestId.next().value;
8
- requestPromises.set(reqId, { resolve, reject });
9
-
10
- return reqId;
11
- }
12
-
13
- export function resolveRequest(reqId, data) {
14
- const { resolve } = requestPromises.get(reqId);
15
- requestPromises.delete(reqId);
16
-
17
- resolve(data);
18
- }
19
-
20
- export function rejectRequest(reqId, data) {
21
- const { reject } = requestPromises.get(reqId);
22
- requestPromises.delete(reqId);
23
-
24
- reject(data);
25
- }
@@ -1,22 +0,0 @@
1
- // https://stackoverflow.com/questions/17575790/environment-detection-node-js-or-browser
2
- export const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');
3
-
4
- export function* idGenerator() {
5
- for (let i = 0; true; i++) {
6
- if (i === Number.MAX_SAFE_INTEGER) {
7
- i = 0;
8
- }
9
-
10
- yield i;
11
- }
12
- }
13
-
14
- export function isString(val) {
15
- return (typeof val === 'string' || val instanceof String);
16
- }
17
-
18
- export function isFunction(func) {
19
- return Object.prototype.toString.call(func) == '[object Function]' ||
20
- Object.prototype.toString.call(func) == '[object AsyncFunction]';
21
- }
22
-
package/tsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "include": ["src/**/*.js"],
3
-
4
- "compilerOptions": {
5
- // Tells TypeScript to read JS files, as
6
- // normally they are ignored as source files
7
- "allowJs": true,
8
- // Generate d.ts files
9
- "declaration": true,
10
- // This compiler run should
11
- // only output d.ts files
12
- "emitDeclarationOnly": true,
13
- // Types should go into this directory.
14
- // Removing this would place the .d.ts files
15
- // next to the .js files
16
- "outDir": "types",
17
- // go to js file when using IDE functions like
18
- // "Go to Definition" in VSCode
19
- "declarationMap": true
20
- }
21
- }