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

Make import syntax more succinct #22

Open
mickmcgrath13 opened this issue May 24, 2017 · 0 comments
Open

Make import syntax more succinct #22

mickmcgrath13 opened this issue May 24, 2017 · 0 comments

Comments

@mickmcgrath13
Copy link
Collaborator

Currently, the import syntax is like this:

<can-import from="can-stache-animate" {^value.animations}="*animations" />
<div (. shake)="*animations.shake"></div>

as @chasenlehara pointed out, it would be nicer to do something like this:

<can-import from="can-stache-animate" {^value}="*animations" />
<div (. shake)="*animations.shake"></div>

from #14:

{^value.animations}="*animations" is ok (after getting rid of default when moving to ES5), although my vote would be to export the animations as the module’s value and add the additional methods on it, so it would look something like this:

import canStacheAnimations from 'can-stache-animations';
// canStacheAnimations is an array of animations so you can write `{^value}="*animations"`
canStacheAnimations.register();// Accept a list of animations, e.g. register({}, {})
canStacheAnimations.setDefaults();// Accept an object, e.g. setDefaults({duration: 500})
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