Skip to content

Use a faster Function.prototype.bind utility function #1762

@ngokevin

Description

@ngokevin

Description:

Bind is slow. The answer says that the native one does a lot of unnecessary stuff when we just want:

function bind(fn, ctx) {
    return function bound() {
        return fn.apply(ctx, arguments);
    };
}

I'd probably put this in src/utils/function.js so it is resistant to future possible namespacing. And then replace all our calls of bind with the new faster bind

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions