2018-03-25 02:34:35 +00:00
|
|
|
/* eslint-disable no-return-assign */
|
2018-03-25 01:23:46 +00:00
|
|
|
let ready = false;
|
2018-03-25 02:34:35 +00:00
|
|
|
process.on('bridge-attached', () => (ready = true));
|
2018-03-25 01:23:46 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
wait() {
|
|
|
|
if (ready) return Promise.resolve();
|
|
|
|
return new Promise(resolve => {
|
|
|
|
process.once('bridge-attached', resolve);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
reset() {
|
|
|
|
ready = false;
|
|
|
|
},
|
|
|
|
};
|