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

Define callback methods on the model programatically #8

Open
beeman opened this issue Jun 23, 2015 · 0 comments
Open

Define callback methods on the model programatically #8

beeman opened this issue Jun 23, 2015 · 0 comments

Comments

@beeman
Copy link
Contributor

beeman commented Jun 23, 2015

This is copied from #5


In a future version it would be nice the possibility of adding the logic of this mixin programatically:

/**
 * var changed = {
 *   ids: {
 *     '123': 'processing',
 *     '456': 'processing',
 *     '789': 'on-hold'
 *   },
 *   values: {
 *     'processing': ['123', '456'],
 *     'on-hold': ['789']
 *   }
 * }
 */
Fulfillment.onChanged('status', function(changed) {
    // do first thing on changed status
});

Fulfillment.onChanged('status', function(changed) {
    // do another thing on changed status
});

And even watch a specific property value:

/**
 * var changed =  ['123', '456'];
 */
Fulfillment.onChangedValue('status', 'cancelled', function(changed) {
    // this is triggered when status changed to cancelled
});
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