Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on can-define #1

Open
DesignByOnyx opened this issue Dec 14, 2018 · 0 comments
Open

Remove dependency on can-define #1

DesignByOnyx opened this issue Dec 14, 2018 · 0 comments

Comments

@DesignByOnyx
Copy link
Contributor

DesignByOnyx commented Dec 14, 2018

In order to support two decorator syntaxes, we need to determine whether or not a DefineMap constructor or plain object is being passed:

@singleton
const MyType = DefineMap.extend({});

@singleton( options )
const MyType = DefineMap.extend({});

Right now, we check whether or not the decorator arguments pass this test:

function singleton(Obj) {
  if(Obj.prototype instanceof DefineMap) ...
  else ...
}

It should be fairly trivial to change this into something more generic - something which uses can-reflect'sisPlainObject() or possibly isConstructorLike(). My vote is for the latter.

Furthermore, there's code in here which defines a List property on the constructor if one is not yet defined. This code can go away whenever this issue is resolved:
canjs/can-connect#446

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant