Skip to content

create factory should invoke function with context if module is a method of an object #176

Description

@ChrisEineke

By allowing the resolved method to be called with a bound this, it would allow one to implement the Builder pattern without having to pass all dependencies as method parameters (because this is undefined). At first glance this could be accomplished by fixing instantiate.js's instantiate function to provide a this arg in the invocation of apply:

begotten = ctor.apply(undef, args);

I also tried to use the invoker factory, but there some spookiness going on with regards to promises...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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