Resolves #34. Added delay lib to renderer and added a magic delay before ending devices.ready(). Just works. Move on and don't question it.

This commit is contained in:
sixteenmillimeter 2020-01-09 18:06:18 -05:00
parent 4c0aa4220c
commit fc2593c6ee
4 changed files with 82 additions and 67 deletions

View File

@ -2496,6 +2496,7 @@ const devices = require('./lib/ui/devices.js');
const filmout = require('./lib/ui/filmout.js');
const mse = require('./lib/ui/mscript.js');
const Mscript = require('./lib/mscript');
const { delay } = require('./lib/delay');
let log;
/******

View File

@ -1,4 +1,13 @@
'use strict';
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
let devices;
class Devices {
constructor() {
@ -15,18 +24,20 @@ class Devices {
ipcRenderer.on('intval', this.intvalCb.bind(this));
}
ready(event, arg) {
return __awaiter(this, void 0, void 0, function* () {
//console.dir(arg)
let opt;
let devs = [];
let notify = 'Connected to ';
let p;
//@ts-ignore
yield delay(1000);
try {
gui.spinner(false);
gui.overlay(false);
console.log('got here');
}
catch (err) {
console.error(err);
log.error(err);
}
for (let i in arg) {
devs.push(arg[i].arduino);
@ -85,6 +96,7 @@ class Devices {
cam.second.enable();
}
return event.returnValue = true;
});
}
profiles() {
const keys = Object.keys(cfg.profiles);

View File

@ -22,6 +22,7 @@ const devices = require('./lib/ui/devices.js');
const filmout = require('./lib/ui/filmout.js');
const mse = require('./lib/ui/mscript.js');
const Mscript = require('./lib/mscript');
const { delay } = require('./lib/delay');
let log;
/******

View File

@ -33,19 +33,20 @@ class Devices {
ipcRenderer.on('intval', this.intvalCb.bind(this));
}
ready (event : any, arg : any) {
async ready (event : any, arg : any) {
//console.dir(arg)
let opt : any;
let devs : any[] = [];
let notify : string = 'Connected to ';
let p : any;
//@ts-ignore
await delay(1000);
try {
gui.spinner(false);
gui.overlay(false);
console.log('got here');
} catch (err) {
console.error(err);
log.error(err);
}
for (let i in arg) {
devs.push(arg[i].arduino);