Skip to content

.attach isn't separated by instance #1

Description

@dploeger

If you use .attach to attach options-api to a class, the options modified in one instance are also modify in other instances.

Take this example:

var optionsApi = require('options-api');
function Test() {}
optionsApi.attach(Test, { "a": "a", "b":"b" });
a = new Test();
a.get("a"); // returns "a"
a.set("a","b");
b = new Test();
b.get("a"); // returns "b"

I would expect, that b.get("a") would return "a" as it's the default value. Am I doing something wrong here or is it a bug?

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