Skip to content

Instantly share code, notes, and snippets.

@thom4parisot
Forked from ggrossetie/asciidoctor-cli-await.js
Last active January 31, 2020 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thom4parisot/f5583337eae10e8a80734d6853304999 to your computer and use it in GitHub Desktop.
Save thom4parisot/f5583337eae10e8a80734d6853304999 to your computer and use it in GitHub Desktop.
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()
>>> super.invoke()
>>> convertFromStdin
<<< convertFromStdin data
<<< super.invoke()
do something
>>> 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