mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
Change splice.call(arguments, ..) to use slice
- Bypasses issue of usage incorrectly omitting 2nd argument to `splice` - More clear of intent; `slice` does not modifify `arguments` - `slice` is faster across all desktop browsers, by varying degrees - Probably due to parameter-aliasing and de-opts when modified. - Both `slice` and `splice` create a new Array object
This commit is contained in:
parent
bae732ca9e
commit
26a6338072
6 changed files with 8 additions and 8 deletions
|
@ -52,7 +52,7 @@ Phaser.PluginManager.prototype = {
|
|||
*/
|
||||
add: function (plugin) {
|
||||
|
||||
var args = Array.prototype.splice.call(arguments, 1);
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
var result = false;
|
||||
|
||||
// Prototype?
|
||||
|
|
|
@ -308,7 +308,7 @@ Phaser.StateManager.prototype = {
|
|||
|
||||
if (arguments.length > 2)
|
||||
{
|
||||
this._args = Array.prototype.splice.call(arguments, 2);
|
||||
this._args = Array.prototype.slice.call(arguments, 2);
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -414,7 +414,7 @@ Phaser.GameObjectCreator.prototype = {
|
|||
*/
|
||||
filter: function (filter) {
|
||||
|
||||
var args = Array.prototype.splice.call(arguments, 1);
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
var filter = new Phaser.Filter[filter](this.game);
|
||||
|
||||
|
|
|
@ -531,7 +531,7 @@ Phaser.GameObjectFactory.prototype = {
|
|||
*/
|
||||
filter: function (filter) {
|
||||
|
||||
var args = Array.prototype.splice.call(arguments, 1);
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
var filter = new Phaser.Filter[filter](this.game);
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ Phaser.Timer.prototype = {
|
|||
*/
|
||||
add: function (delay, callback, callbackContext) {
|
||||
|
||||
return this.create(delay, false, 0, callback, callbackContext, Array.prototype.splice.call(arguments, 3));
|
||||
return this.create(delay, false, 0, callback, callbackContext, Array.prototype.slice.call(arguments, 3));
|
||||
|
||||
},
|
||||
|
||||
|
@ -264,7 +264,7 @@ Phaser.Timer.prototype = {
|
|||
*/
|
||||
repeat: function (delay, repeatCount, callback, callbackContext) {
|
||||
|
||||
return this.create(delay, false, repeatCount, callback, callbackContext, Array.prototype.splice.call(arguments, 4));
|
||||
return this.create(delay, false, repeatCount, callback, callbackContext, Array.prototype.slice.call(arguments, 4));
|
||||
|
||||
},
|
||||
|
||||
|
@ -285,7 +285,7 @@ Phaser.Timer.prototype = {
|
|||
*/
|
||||
loop: function (delay, callback, callbackContext) {
|
||||
|
||||
return this.create(delay, true, 0, callback, callbackContext, Array.prototype.splice.call(arguments, 3));
|
||||
return this.create(delay, true, 0, callback, callbackContext, Array.prototype.slice.call(arguments, 3));
|
||||
|
||||
},
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ Phaser.ArraySet.prototype = {
|
|||
*/
|
||||
callAll: function (key) {
|
||||
|
||||
var args = Array.prototype.splice.call(arguments, 1);
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
var i = this.list.length;
|
||||
|
||||
|
|
Loading…
Reference in a new issue