Skip to content

Instantly share code, notes, and snippets.

@fadec
fadec / promise_subclass.js
Last active September 14, 2016 19:39
How to subclass ES6 Promises with customized constructor. 99% of the time, you shouldn't.
class ValueInTime
{
constructor (value, time)
{
this.result = new Promise ((fulfill, reject) => {
this.fulfill = fulfill
this.reject = reject
})
this.value = value
this.time = time