Skip to content

fcts needs to be on instances, not prototype #1

Open
@isaacs

Description

@isaacs

Since fcts is on the prototype, and an object, it's shared by all instances of the same emitter class.

function Foo () {}
MicroEvent.mixin(Foo)
f = new Foo
b = new Foo
f.bind("blerg", function () { console.log("f got blerg") })
b.trigger("blerg")

Instead of putting fcts on the prototype, you must check for it on the object at the start of the bind/trigger/unbind functions and default it to {} if it's not set or not an object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions