ES3.1 Draft: 11 June 2008 version available
André Rømcke
ar at ez.no
Thu Jun 12 05:48:02 PDT 2008
Hi, and thanks for any work on making ES3 better while we wait for ES4!
One thing I miss form the targeted additions part of the spec is:
function.bindEvent aka function.bindEventListener
The difference from function.bind is that binded arguments are appended
after instead of before the arguments when called.
Example code for function.bind and function.bindEvent (where arguments is
a true array):
function.bind = function()
{
// Binds arguments to a function, so when you call the returned
wrapper function,
// arguments are intact and arguments passed to the wrapper function
is appended.
// first argument is 'this' and the rest is arguments
var args = arguments, __fn = this, __object = args.shift();
return function(){ return __fn.apply(__object, args.concat(arguments))};
};
function.bindEvent = function()
{
// Same as bind, but prepends the arguments to the wrapper function
var args = arguments, __fn = this, __object = args.shift();
return function(){ return __fn.apply(__object, arguments.concat(args))};
};
http://wiki.ecmascript.org/doku.php?id=es3.1:targeted_additions_to_array_string_object_date
On Thu, June 12, 2008 2:01 am, Pratap Lakshman (VJ#SDK) wrote:
> I have uploaded to the wiki
> (link<http://wiki.ecmascript.org/doku.php?id=es3.1:es3.1_proposal_working_draft>,
> see under "Draft Specification") the current draft of the specification
> for ES3.1. This is in the form of in-place edits and markups to the ES3
> specification. Revision history is at the end of the document.
>
> pratap
>
--
Best Regards / Med vennlig hilsen
André Rømcke
System consultant & eZ Labs developer
eZ Systems Nordic
ar at ez.no | +47 21 53 69 13 | www.ez.no
More information about the Es4-discuss
mailing list