Closed daretodave closed 6 months ago
resolves #14
introduces the context.content(Yes) operation
context.content(
)
content can have events attached to them e.g
const no = context.content(`<button>No</button>`) no.on('click', () => { context.out('\n\nDeclined reset') context.finish(0) })
or more complex -
context.out('Reset all mterm settings, commands, modules?\n') const yes = context.content(`<button>Yes</button>`) context.out('|') const no = context.content(`<button>No</button>`) no.on('click', () => { context.out('\n\nDeclined reset') context.finish(0) }) yes.on('click', async () => { context.out('\n\nCleaning...') await remove(context.workspace.folder) context.out('\nReloading...') await context.workspace.load() context.out('- settings reloaded \n') await context.workspace.commands.load(context.workspace.settings) context.out('- commands reloaded \n') await context.workspace.reload(RunnerWindow) context.out('- window reloaded \n') context.finish(0) })
content can also be updated e.g (a clock)
context.out('Time: ') let minute = 0 let second = 0 const M = context.content(`<span>00</span>`) context.out(':') const S = context.content(`<span>00</span>`) setInterval(() => { S.update(`<span>${`${second++}`.padStart(2, '0')}</span>`) }, 1000) setInterval(() => { M.update(`<span>${`${minute++}`.padStart(2, '0')}</span>`) }, 1000 * 60)
resolves #14
introduces the
context.content(
)
operationcontent can have events attached to them e.g
or more complex -
content can also be updated e.g (a clock)