implemented 'run' databinding for use with things like .animate (ticket #39) #40

wants to merge 4 commits into


None yet

2 participants


No description provided.

weepy commented on a97c666 Apr 4, 2012

nice - so it's a kinda no-op binding. maybe call or run might be a better name ?

weepy replied Apr 4, 2012

there's also onbind currently - what's the difference here ?


can you show me an example of how one would use onbind? also, I do like run better than element, yes

weepy replied Apr 4, 2012

.. so I've been using it to setup drag handlers for instance.


I looked through the o_O.js source and only found two references to onbind. I wasn't able to figure out how to use it...

weepy replied Apr 4, 2012

so here's some example code.

Model.prototype.onbind = function() {
    var self = this
        .drag(function(e, dd) {
          var params = self.params()
            var val = dd.offsetX.snap(params.snapX*params.sizeX, 0.2) / params.sizeX
        }, {relative: true, distance: 2})
        .drag("end", function(e, dd) {
          var params = self.params()
          var val = (dd.offsetX/params.sizeX).snap(params.snapX)

the point is that it's only run once and won't get called again when a dependency is changed. perhaps it could be called once, but I'm not sure

@weepy weepy closed this Apr 5, 2012
weepy commented Apr 5, 2012

OK - I've pulled this in under the name call

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