New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 0.4 #47
Version 0.4 #47
Conversation
Following example transform failing task into task that always succeeds with Result<error, value>: ``` new Task(exec) .recover(Result.error) .map(Result.ok) ```
It made little very little sense that Effects.tick was a special type of Effect. This change moves functionality provided by it into `Task.requestAnimationFrame` instead & provides temporary backwards compatibility with warning via new implementation.
Prior name was confusing especially since it had to be passed a task instance. `Effects.perform(task)` seems to better communicate intents.
Those changes changed finally blocks to catch blocks which meant they would only be executed on exceptions, which was incorrect since finally blocks always execute & in this instances they performed state updates. More specifically synchronous tasks would no longer run given that messages would be queued into inbox but new messages were only checked on exceptions or when new messages arrived.
driver = previous | ||
|
||
if (exception != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if render()
throws null
? Probably not a problem in practice, but at least comment to that effect. If it could be a real problem, then change this to something like
// Somewhere above `renderWith`
const NoExceptionSentinel = {};
// At the top of `renderWith`
let exception = NoExceptionSentinel;
// At the end of `renderWith`
if (exception !== NoExceptionSentinel) {
...
}
Looks good with feedback addressed. I'm not too happy with a new |
@tschneidereit Is that in reference to exports of |
@@ -10,6 +10,7 @@ export type {Text, Key, TagName, DOM} | |||
*/ | |||
|
|||
let driver/*:?Driver*/ = null | |||
const absent = new String("absent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, much better than my proposed {}
.
It is, yes. |
I'm afraid I can't think of better name maybe Given that it's just an internal module (that I actually want to factor out into separate package) I'll leave it as is for 0.4 as I would not like to block a release for this. My interpretation of your comment on this was that it was "nice to have" vs "must have". |
That makes sense. |
Overview of the changes
requestAnimationFrame
scheduler fromEffects
library and expose it via tasks instead. Having it part ofEffects
did not really made much sense.Effects.task(task)
toEffects.perform(task)
as former was pretty confusing.requestAnimationFrame
task that are used a lot during animations.Task.prototype.recover
API so that task failures can more efficiently & intuitively be translated to error actions.