Skip to content

Commit

Permalink
Remote behaviors now bind callbacks to the event instance
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.danwebb.net/external/lowpro/trunk@417 a686c101-5f17-0410-80e1-b267258107f6
  • Loading branch information
danwebb committed Mar 19, 2008
1 parent 9743265 commit c70db2c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dist/lowpro.js
Expand Up @@ -284,8 +284,8 @@ Remote.Base = {
},
_bindCallbacks: function() {
$w('onCreate onComplete onException onFailure onInteractive onLoading onLoaded onSuccess').each(function(cb) {
if (Object.isFunction(this[cb.toLowercase()]))
this.options[cb] = this[cb.toLowercase()].bind(this);
if (Object.isFunction(this.options[cb]))
this.options[cb] = this.options[cb].bind(this);
}.bind(this));
}
}
Expand Down
Binary file modified dist/lowpro.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions src/core_behaviors.js
Expand Up @@ -20,8 +20,8 @@ Remote.Base = {
},
_bindCallbacks: function() {
$w('onCreate onComplete onException onFailure onInteractive onLoading onLoaded onSuccess').each(function(cb) {
if (Object.isFunction(this[cb.toLowercase()]))
this.options[cb] = this[cb.toLowercase()].bind(this);
if (Object.isFunction(this.options[cb]))
this.options[cb] = this.options[cb].bind(this);
}.bind(this));
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/lowpro.js
Expand Up @@ -284,8 +284,8 @@ Remote.Base = {
},
_bindCallbacks: function() {
$w('onCreate onComplete onException onFailure onInteractive onLoading onLoaded onSuccess').each(function(cb) {
if (Object.isFunction(this[cb.toLowercase()]))
this.options[cb] = this[cb.toLowercase()].bind(this);
if (Object.isFunction(this.options[cb]))
this.options[cb] = this.options[cb].bind(this);
}.bind(this));
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/test-b-classes.html
Expand Up @@ -22,7 +22,7 @@

Event.addBehavior({
'.dates' : DateSelector,
'.remote' : Remote({ method: 'post' }),
'.remote' : Remote({ method: 'post', onCreate: function() { console.log(this) } }),
'.remote_form' : Remote,
'#date2': Observed(function() { console.log('changed field') }, { frequency: 0.2 })
});
Expand Down

0 comments on commit c70db2c

Please sign in to comment.