Script expansions
I added scheduling functions! setInterval(cb, delay, interval)
and setTimeout(cb, delay)
are now supported. But keep in mind,
they take in delays and intervals in ticks, not milliseconds. Both of these
functions return an ID integer that represents their task ID.
There is of course an accompanying clearTimeout(taskId)
to
cancel both interval and timeout tasks.
This was all made possible with the scheduling API I added to the
DocumentView
. This quick little API allows you to schedule tasks
that run after a certain amount of ticks or are run over and over. Once the
view itself is closed, the tasks are closed and don't execute.
Custom Events
I also added support for custom events, which I thought might be a good way for plugins to communicate with menus written with JS, or just a good way to communicate with menus, really.
|
|
Other
There isn't really any other changes, I fixed a weird jerk that would happen when you set a text node's text content to a text with a different size. For less than a tick, it would be squished or stretched out before correcting.
This was happening because the renderer's callback for a text node's content being modified would directly update that text node's render object. But the actual layout update would happen when the view's tick method was called, much later. This difference caused a half second of the text looking smushed or stretched before being updated again.