`setTimeout` is not part of ECMAScript. You should suggest this to WHATWG 
instead.

- Oriol

From: [email protected]
Date: Mon, 25 Apr 2016 17:35:50 +0000
Subject: Proposal: Switch position of delay and callback in signature of        
`setTimeout()`
To: [email protected]

Everytime I use `setTimeout()`, I wonder why the the arguments are in the wrong 
order. Usually the callback functions comes last, but in 'setTimeout' it's 
exactly the other way round.

So I propose that the order should be reversed to be consistent with other 
functions.Instead of `setTimeout(callback, delay[, arg][, ...])` it should be 
`setTimeout(delay, callback[, arg][, ...])`

By checking the type of the first two arguments (which one is the 
function)backwards compatibility can be achieved.

So a polyfill would be something like:
```newSetTimeout = (delay, callback, ...args) => {  if (typeof delay === 
'function') {    setTimeout(delay, callback, ...args)  }  else {    
setTimeout(callback, delay, ...args)  }}```
What do you think?

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss                                    
  
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to