3 ms·
I can't help feeling that all of the examples contain too much copy and pasting. This is dealt with by taking a higher order approach to the problem. Which is
by moomin 16y ago
I can't help feeling that all of the examples contain too much copy and pasting. This is dealt with by taking a higher order approach to the problem. Which is what async.js is for.
doSomething = (c) ->
async.waterfall [
(c) -> mainWindow.menu "File", c
(file, c) -> file.openMenu c
(menu, c) -> menu.item "Open", c
(item, c) -> item.click c
(c) -> mainWindow.getChild type("Window"), c
(dialog, c) -> dialog.doSomething c null
]
It's not perfect, but I think it's pretty readable and succinct.