Properly export and require delay module in sequencer

This commit is contained in:
mmcwilliams 2019-10-11 18:24:41 -04:00
parent d90dfc4a6c
commit 8974c8ddcc
9 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,5 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Delay in an async/await function
*
@ -12,4 +13,5 @@ function delay(ms) {
});
}
module.exports.delay = delay;
exports.default = delay;
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delay/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;IAMI;AAEJ,SAAS,KAAK,CAAE,EAAW;IAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAa,EAAE,EAAE;QACpC,OAAO,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delay/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;IAMI;AAEJ,SAAS,KAAK,CAAE,EAAW;IAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAa,EAAE,EAAE;QACpC,OAAO,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AAE7B,kBAAe,KAAK,CAAC"}

View File

@ -2,6 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const uuid = require('uuid').v4;
const log = require('../log')('seq');
require("../delay");
/** Object sequence features */
class Sequence {
constructor() {
@ -31,7 +32,7 @@ class Sequence {
this._state.stop = null;
};
}
async start(options, cb) {
start(options, cb) {
if (this._state.active) {
return false;
}

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/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AAK,EAAE,KAAK,EAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;SAC5F;IACF,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,IAAI,QAAQ,EAAE,CAAC"}

3
package-lock.json generated
View File

@ -527,9 +527,6 @@
"clone": "^1.0.2"
}
},
"delay": {
"version": "file:lib/delay"
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",

View File

@ -27,7 +27,6 @@
"dependencies": {
"bleno": "^0.5.0",
"cron": "^1.7.2",
"delay": "file:lib/delay",
"node-ipc": "^9.1.1",
"node-persist": "^3.0.5",
"onoff": "^5.0.0",

View File

@ -15,3 +15,5 @@ function delay (ms : number) {
}
module.exports.delay = delay;
export default delay;

1
src/global.d.ts vendored
View File

@ -1 +0,0 @@
declare module 'delay';

View File

@ -2,11 +2,11 @@
const uuid = require('uuid').v4
const log = require('../log')('seq')
import * as delay from 'delay'
import '../delay'
/** Object sequence features */
class Sequence {
private _state : any = {
public _state : any = {
arr : [],
active : false,
paused : false,
@ -16,7 +16,7 @@ class Sequence {
stop : null
}
private _loop : any = {
public _loop : any = {
arr : [],
count : 0,
max : 0
@ -26,7 +26,7 @@ class Sequence {
}
public async start (options : any, cb : Function) {
public start (options : any, cb : Function) {
if (this._state.active) {
return false
}