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

Fixes updated callback to can.compute's on/off to simply need to be called. #733

Merged
merged 2 commits into from
Feb 10, 2014

Conversation

justinbmeyer
Copy link
Contributor

The following was not working:

var value = can.compute('', {
    get: function () {
        return input.value;
    },
    set: function (newVal) {
        input.value = newVal;
    },
    on: function (update) {
        input.onchange = update;
    },
    off: function () {
        delete input.onchange;
    }
});

If the user changed the input value, update would be called with the event, setting the value of the event to the compute. This changes the update function to use the get function to retrieve a new value and check if the value has changed before triggering the event.

@justinbmeyer justinbmeyer added this to the 2.0.6 milestone Feb 9, 2014
daffl added a commit that referenced this pull request Feb 10, 2014
Fixes `updated` callback to can.compute's on/off to simply need to be called.
@daffl daffl merged commit 59294fc into master Feb 10, 2014
@daffl daffl deleted the compute-updated-fix branch February 10, 2014 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants