How to use the deasync.loopWhile function in deasync

To help you get started, we’ve selected a few deasync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gazooka / GhostInAzureWebApp / postinstall.js View on Github external
.on('error', function () {
			logging.error('Failed to create server.cache.js.gz');
			compressionFinished = true;
		})
		.pipe(output)
		.on('finish', function () {
			logging.info('Created server.cache.js.gz');
			compressionFinished = true;
		})
		.on('error', function () {
			logging.error('Failed to create server.cache.js.gz');
			compressionFinished = true;
		});

	// wait for compression to complete
	deasync.loopWhile(function(){return !compressionFinished;});
}
github wix / redux-testkit / src / mockStore.js View on Github external
dispatchSync(action) {
    let done = false;
    let result;
    action(this.mockDispatch, this.getState).then((r) => {
      result = r;
      done = true;
    });
    require('deasync').loopWhile(() => !done);
    //require('deasync').sleep(100);
    return result;
  }
github Strider-CD / core / test / helpers / persistence.js View on Github external
beforeEach: function (cb) {
      mongoose.connect(config.mongoDbURI)
      require('deasync').loopWhile(function () {
        return mongoose.connection.readyState !== 1
      })
      cb()
    },
    afterEach: function (cb) {
github wix / redux-testkit / lib / mockStore.js View on Github external
}},{key:'dispatchSync',value:function dispatchSync(

action){
var done=false;
var result=void 0;
action(this.mockDispatch,this.getState).then(function(r){
result=r;
done=true;
});
require('deasync').loopWhile(function(){return!done;});
//require('deasync').sleep(100);
return result;
}},{key:'dispatch',value:function dispatch(
github rincojs / rinco-sg / lib / middleware / rinco-parse-render.js View on Github external
content = it.parse(content, tag, function (prc) {
            var s = prc.trim().split('=>');
            var data = JSON.parse(s[1].trim());
            var done = false;
            var content;
            rinco.render.file(rinco.fs.path.join(config.PAGES_DIR, s[0].trim()), function (data) {
               content = data;
               done=true;
           }, ['rinco_js', 'rinco_css', 'rinco_reload', 'rinco_mustache'], true);
            require('deasync').loopWhile(function(){return !done;});
            return rinco.render.mustache.to_html(content, data);
        });
    });
github sentialx / node-window-manager / src / macos.ts View on Github external
callSync(cmd: string) {
    p.stdin.write(`${cmd}\n`);

    let data: string;

    p.stdout.once("data", d => {
      data = d.toString();
    });

    while (!data) deasync.roo;
    deasync.loopWhile(() => !data);

    return data;
  }
github tmobile / jazz / platform_events / components / secret-handler.js View on Github external
"message": body.data.plain_text
						};
						done = true;
					} else {
						data = {
							"error": true,
							"message": body.message
						};
						done = true;
					}
				}

			});

			require('deasync').loopWhile(function () {
				return !done;
			});
			return data;

		}
	};
github bradlc / tinker.macro / macro.js View on Github external
}
      done = true
    }
    if (reallyDone) {
      return
    }
    if (data.toString().startsWith('>>>')) {
      if (done) {
        tinker.stdin.write(`json_encode($_)\n`)
      } else {
        tinker.stdin.write(`${php.replace(/[\n\r]/g, ' ').trim()}\n`)
      }
    }
  })

  deasync.loopWhile(() => !reallyDone)

  tinker.stdin.end()

  return result
}
github nicolaspanel / numjs / src / images / read.js View on Github external
var done = false;
  var hxw;
  sharp(input)
    .raw()
    .toBuffer(function (err, data, info) {
      if (err) { throw err; }
      var shape = [info.width | 0, info.height | 0, info.channels];
      var stride = [info.channels, info.channels * info.width | 0, 1];
      var wxh = new NdArray(new Uint8Array(data), shape, stride, 0);
      hxw = wxh.transpose(1, 0);
      if (isGrayscale(hxw)) {
        hxw = hxw.pick(null, null, 1);
      }
      done = true;
    });
  deasync.loopWhile(function () { return !done; });
  return hxw;
};
github dapphub / dapple / lib / dapplerc_prompter.js View on Github external
rc.environments.live = {
        ethereum: {
          host: res.eth_host,
          port: res.eth_port,
          account: res.default_account
        },
        ipfs: {
          host: res.ipfs_host,
          port: res.ipfs_port
        }
      };

      done = true;
    });
    deasync.loopWhile(function () { return !done; });
    DappleRC.validate(rc);
    return rc;
  }
};

deasync

Turns async function into sync via JavaScript wrapper of Node event loop

MIT
Latest version published 6 months ago

Package Health Score

75 / 100
Full package analysis