1.2.1 • Published 8 months ago

@thegraid/ezpromise v1.2.1

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

ezpromise

Promise without lexical binding requirements

Constuctor: new EzPromise()\<T> Note: do not supply any argument for: (fil, rej) => {...}

EzPromise\<T> methods: .fulfill(value: T) .reject(reason: any) Access fields: .hasResolved: boolean; .value: T; .reason: any

Either .fulfill(value) or .reject(reason) can be called ONCE, at which point .hasResolved === true and no futher alteration can be made.

let ezp1 = EzPromise<string>()
ezp1.catch((reason) => { console.log("failed with:", reason)})
exp1.then((value) => { console.log("success:", value)})
exp1.fulfill("good value")
console.log("ezp1 value =", ezp1.value)

let ezp2 = EzPromise<string>()
ezp2.catch((reason) => { console.log("failed with:", reason)})
exp2.then((value) => { console.log("success:", value)})
exp2.reject("rejected")
console.log("ezp2 reason =", ezp2.reason)

published in npm registery: @thegraid/ezpromise

1.2.0

8 months ago

1.2.1

8 months ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.2

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago