3 ms·
I don't know js-csp (I prefer ES7 async/await + promises or streams) so correct me if I'm wrong, but the "csp.go" here isn't required since it's a single operat
by tlrobinson 11y ago
I don't know js-csp (I prefer ES7 async/await + promises or streams) so correct me if I'm wrong, but the "csp.go" here isn't required since it's a single operation and the return value isn't used:
csp.go(function*(){
yield csp.put(channel, {actionType: 'incr'});
});
I assume it's essentially the same as doing the following using async/await:
(async function() {
await csp.put(...);
})();
Which is pointless.
- idibidiart 11y agoI think the idea is to update the model asynchronously via put before rendering the new state via take. I'm not entirely sure (I don't know csp much) but I think using a single CSP channel makes that trivial, so you're always updating before rendering. Would appreciate more insight and/or correction...
- tlrobinson 11y agoRight, but I presume csp.put() is asynchronous already, there's no point in wrapping it in csp.go().