Last active
March 11, 2019 00:01
-
-
Save ORESoftware/200f2cc6d5b20c057597d1a3ece0341e to your computer and use it in GitHub Desktop.
promise api technique
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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