0.1.0 • Published 6 years ago

@bidq/client v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

bidqjs

JS SDK for BidQ

Usage (creating tasks)

const BidQ = require("@bidq/client");

const bidq = new BidQ({ port: 8888 });

async function main() {
  const jobId = await qbid.submit("add", { x: 1, y: 2 }, 2000);
  try {
    console.log(await qbid.get(jobId));
  } catch (err) {
    console.error(err);
  } finally {
    await qbid.close();
  }
}

main();

Usage (resolving tasks)

const BidQ = require("@bidq/client");

const bidq = new BidQ({ port: 8888 });

qbid.on("add", ({ x, y }, resolve) => {
  console.log("Adding...");
  resolve(x + y);
});