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

Projects
None yet
2 participants
@justinbmeyer
Contributor

justinbmeyer commented Feb 9, 2014

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

@justinbmeyer justinbmeyer added the Bug label Feb 9, 2014

daffl added a commit that referenced this pull request Feb 10, 2014

Merge pull request #733 from bitovi/compute-updated-fix
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

1 check passed

default The Travis CI build passed
Details

@daffl daffl deleted the compute-updated-fix branch Feb 10, 2014

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