search for: __method

Displaying 9 results from an estimated 9 matches for "__method".

Did you mean: _method
2006 Feb 21
4
[Prototype] implementation of bind()?
http://dev.rubyonrails.org/browser/spinoffs/prototype/src/base.js contains this definition: Function.prototype.bind = function() { var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments))); } } In other words, if a bound function is given the arguments (This,A,B,C) the underlying method has ''this'' bound to the valu...
2006 Feb 27
3
bindAsEventListener with parameters
...ntListener(this, 5); Event.observe("el2", "click", show.bindAsEventListener(this, 10); That will alert "el1 = 5" when el1 is clicked and "el1 = 10" when el2 is clicked. The changed function: Function.prototype.bindAsEventListener = function(object) { var __method = this; var argumente = $A(arguments); argumente.shift(); // remove "object" from the list => just the additional arguments remain return function(event) { var ar = argumente.slice(0); // copy values ar.unshift(event || window.event); return __method.apply(object, ar)...
2006 Jun 15
3
RE: Yahoo!-like Eventobjectemulation/abstractioninPrototype?
This is obviously rough draft and not thoroughly tested, but it seems to work. If you''d like, give it a try (load it after you load prototype.js): Function.prototype.bindAsEventListener = function(object) { var __method = this; return function(event) { return __method.call(object, new SuperEvent(event || window.event)); } } var SuperEvent = Class.create(); Object.extend(SuperEvent.prototype, { initialize: function (event) { for (attr in event) { this[attr] = event[attr]; } this.target...
2006 Apr 10
1
RE: Re: Prototype Ajax - How to pass my own paramsto onComplete
> Gregory, bind() does support this. It''s my preferred technique. Ah, well, that''s good to know then. I''d always wanted to do it this way, but when I last looked into it, it wasn''t yet supported. That was a while ago, though. Thanks for the heads up. Greg
2005 Aug 01
2
function.prototype.bind return value?
...binding an object method to an existing form''s onSubmit, but it still actually submits the form, refreshing the page - which is not what I want. If change Prototype.js''s bind function to this (Adding just that internal return): Function.prototype.bind = function(object) { var __method = this; return function() { return __method.apply(object, arguments); } } And have my object''s method return false, then it does run the onSubmit function I''ve bound in, and it doesn''t submit try to submit the actual form - which is what I want. This is because...
2006 Mar 03
11
event.keyCode broken in prototype?
I ran 2 tests. One using proto''s Event.observe, and another using an in-line handler of the "keydown" event in a textbox. Using .bindAsEventListener, the event.keyCode is always returning a capital letter, no matter what. The in-line event handler returns lowercase vs. uppercase correctly... What''s going on? I guess I find it hard to believe no one has tried
2006 May 25
13
functions calling functions
I think I may be missing a fundamental concept I hope someone can help me with. I have functions that won''t call other functions. Particularly after an Ajax request. In the following object the ajax request onComplete calls the ajaxFetched function successfully. ajaxFetched tries to call function2 but function2 does not execute. Any ideas or workarounds? thanks Kevin o =
2009 Jul 07
0
[PATCH server] Update app to work with rails 2.3.2
...ames.length == 1 && !names[0] ? [] : names; }, @@ -231,6 +237,11 @@ Object.extend(Function.prototype, { }, timeout); }, + defer: function() { + var args = [0.01].concat($A(arguments)); + return this.delay.apply(this, args); + }, + wrap: function(wrapper) { var __method = this; return function() { @@ -247,8 +258,6 @@ Object.extend(Function.prototype, { } }); -Function.prototype.defer = Function.prototype.delay.curry(0.01); - Date.prototype.toJSON = function() { return '"' + this.getUTCFullYear() + '-' + (this.getUTCMonth()...
2009 Jul 20
9
Upgrade server to run on Rails 2.3.2/F11
Note that one of the 8 patches (#6) will be sent separately in reply to this email, as some of the replaced lines are too long, so git won't let me send the email. However, there is nothing wrong with that patch, and it should be applied in the sequence listed below. Note also that I assume this will be tested on a clean f11 install, rather than an upgrade of an existing ovirt server