Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Last active March 11, 2019 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ORESoftware/200f2cc6d5b20c057597d1a3ece0341e to your computer and use it in GitHub Desktop.
Save ORESoftware/200f2cc6d5b20c057597d1a3ece0341e to your computer and use it in GitHub Desktop.
promise api technique
export class Worker {
getLock(v: string, cb: Function){
this.getLockInternal(v,cb);
}
getLockp(v:string){
return new Promise((resolve,reject) => {
this.getLockInternal(v, (err,result) => {
err ? reject(err) : resolve(result);
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment