Created
November 30, 2018 15:44
-
-
Save juliandescottes/5424b841f9991068cda2aeaff678e12a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Front { | |
async initialize() { | |
throw new Error("initialize Mandatory"); | |
} | |
static async createFront() { | |
const front = new this(); | |
await front.initialize(); | |
return front; | |
} | |
} | |
class FrontA extends Front { | |
async initialize() { | |
await new Promise(r => setTimeout(r, 100)); | |
this._prop = 42; | |
this._Aprop = 42; | |
} | |
} | |
class FrontB extends FrontA { | |
async initialize() { | |
await super.initialize(); | |
await new Promise(r => setTimeout(r, 100)); | |
this._prop = 43; | |
this._BProp = 43; | |
} | |
} | |
var a = await FrontA.createFront(); | |
var b = await FrontB.createFront(); | |
console.log(a, b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment