Forked from ggrossetie/asciidoctor-cli-await.js
Last active
January 31, 2020 11:23
-
-
Save thom4parisot/f5583337eae10e8a80734d6853304999 to your computer and use it in GitHub Desktop.
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
class Invoker { | |
invoke() { | |
return Invoker.convertFromStdin() | |
} | |
static async convertFromStdin() { | |
console.log('>>> convertFromStdin') | |
const data = await Invoker.readFromStdin() | |
console.log('<<< convertFromStdin', data) | |
} | |
static readFromStdin() { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve('data') | |
}, 500) | |
}) | |
} | |
} | |
class AsciidoctorRevealJsInvoker extends Invoker { | |
async invoke() { | |
console.log('>>> super.invoke()') | |
await super.invoke() | |
console.log('<<< super.invoke()') | |
console.log('do something') | |
} | |
} | |
new AsciidoctorRevealJsInvoker().invoke() |
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
>>> super.invoke() | |
>>> convertFromStdin | |
<<< convertFromStdin data | |
<<< super.invoke() | |
do something |
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
>>> super.invoke() | |
>>> convertFromStdin | |
<<< convertFromStdin data | |
<<< super.invoke() | |
do something |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment