Skip to content

Small questions #2

@bcomnes

Description

@bcomnes

This should be this.update() instead of this.render() to take advantage of the raf management yeah?

hui/index.js

Lines 82 to 88 in 568c274

_onload () {
this.loaded = true
this.onload()
// if any listeners were attached in onload we trigger a rerender as state
// may have changed between createElement or unload/load
if (this[unloaders].length) this.render()
}

We should shadow bind this._reallyUpdate in the constructor since update could be called at a high frequency (e.g. some kind of animation loop that uses this.update() to render new frames.)

hui/index.js

Lines 53 to 57 in 568c274

update () {
if (this[updating]) return
this[updating] = true
window.requestAnimationFrame(this._reallyUpdate.bind(this))
}

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions