melonjs 10.2.1 → 10.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +1 -1
  2. package/dist/melonjs.js +2735 -2760
  3. package/dist/melonjs.min.js +3 -3
  4. package/dist/melonjs.module.d.ts +2186 -2162
  5. package/dist/melonjs.module.js +2323 -2362
  6. package/package.json +8 -9
  7. package/src/audio/audio.js +43 -43
  8. package/src/camera/camera2d.js +52 -74
  9. package/src/entity/draggable.js +18 -17
  10. package/src/entity/droptarget.js +19 -18
  11. package/src/entity/entity.js +22 -26
  12. package/src/game.js +2 -2
  13. package/src/index.js +11 -11
  14. package/src/input/gamepad.js +13 -13
  15. package/src/input/input.js +1 -1
  16. package/src/input/keyboard.js +14 -16
  17. package/src/input/pointer.js +42 -35
  18. package/src/input/pointerevent.js +18 -26
  19. package/src/lang/deprecated.js +3 -3
  20. package/src/level/level.js +24 -16
  21. package/src/level/tiled/TMXGroup.js +6 -6
  22. package/src/level/tiled/TMXLayer.js +31 -31
  23. package/src/level/tiled/TMXObject.js +19 -19
  24. package/src/level/tiled/TMXTile.js +11 -12
  25. package/src/level/tiled/TMXTileMap.js +23 -21
  26. package/src/level/tiled/TMXTileset.js +13 -13
  27. package/src/level/tiled/TMXTilesetGroup.js +4 -4
  28. package/src/level/tiled/TMXUtils.js +13 -11
  29. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
  30. package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  31. package/src/level/tiled/renderer/TMXRenderer.js +17 -17
  32. package/src/loader/loader.js +29 -25
  33. package/src/math/color.js +45 -64
  34. package/src/math/math.js +17 -17
  35. package/src/math/matrix2.js +46 -46
  36. package/src/math/matrix3.js +64 -64
  37. package/src/math/observable_vector2.js +45 -57
  38. package/src/math/observable_vector3.js +56 -70
  39. package/src/math/vector2.js +60 -59
  40. package/src/math/vector3.js +65 -64
  41. package/src/particles/emitter.js +53 -55
  42. package/src/particles/particle.js +1 -1
  43. package/src/physics/body.js +44 -44
  44. package/src/physics/bounds.js +34 -34
  45. package/src/physics/collision.js +15 -16
  46. package/src/physics/detector.js +10 -10
  47. package/src/physics/quadtree.js +19 -17
  48. package/src/physics/sat.js +17 -17
  49. package/src/physics/world.js +12 -10
  50. package/src/plugin/plugin.js +6 -6
  51. package/src/renderable/GUI.js +13 -18
  52. package/src/renderable/collectable.js +3 -3
  53. package/src/renderable/colorlayer.js +4 -4
  54. package/src/renderable/container.js +64 -46
  55. package/src/renderable/imagelayer.js +30 -31
  56. package/src/renderable/nineslicesprite.js +13 -13
  57. package/src/renderable/renderable.js +68 -66
  58. package/src/renderable/sprite.js +57 -43
  59. package/src/renderable/trigger.js +14 -15
  60. package/src/shapes/ellipse.js +27 -26
  61. package/src/shapes/line.js +8 -7
  62. package/src/shapes/poly.js +33 -31
  63. package/src/shapes/rectangle.js +50 -96
  64. package/src/state/stage.js +6 -6
  65. package/src/state/state.js +54 -54
  66. package/src/system/device.js +97 -84
  67. package/src/system/event.js +72 -72
  68. package/src/system/pooling.js +14 -14
  69. package/src/system/save.js +6 -3
  70. package/src/system/timer.js +20 -20
  71. package/src/text/bitmaptext.js +27 -33
  72. package/src/text/bitmaptextdata.js +9 -9
  73. package/src/text/text.js +39 -41
  74. package/src/tweens/easing.js +4 -4
  75. package/src/tweens/interpolation.js +4 -4
  76. package/src/tweens/tween.js +37 -27
  77. package/src/utils/agent.js +9 -8
  78. package/src/utils/array.js +4 -4
  79. package/src/utils/file.js +4 -4
  80. package/src/utils/function.js +5 -5
  81. package/src/utils/string.js +12 -12
  82. package/src/utils/utils.js +19 -19
  83. package/src/video/canvas/canvas_renderer.js +90 -90
  84. package/src/video/renderer.js +40 -39
  85. package/src/video/texture.js +74 -75
  86. package/src/video/video.js +30 -30
  87. package/src/video/webgl/buffer/vertex.js +9 -1
  88. package/src/video/webgl/glshader.js +20 -20
  89. package/src/video/webgl/webgl_compositor.js +33 -34
  90. package/src/video/webgl/webgl_renderer.js +104 -104
@@ -1,10 +1,10 @@
1
1
  import EventEmitter from "eventemitter3";
2
2
 
3
3
  /**
4
- * an event system based on nodeJS EventEmitter interface
5
- * @namespace event
6
- * @memberOf me
7
- */
4
+ * an event system based on nodeJS EventEmitter interface
5
+ * @namespace event
6
+ * @memberOf me
7
+ */
8
8
 
9
9
  // internal instance of the event emiter
10
10
  var eventEmitter = new EventEmitter();
@@ -13,7 +13,7 @@ var eventEmitter = new EventEmitter();
13
13
  * event when the system is booting
14
14
  * @public
15
15
  * @constant
16
- * @type String
16
+ * @type {string}
17
17
  * @name BOOT
18
18
  * @memberOf me.event
19
19
  * @see me.event.on
@@ -25,7 +25,7 @@ export const BOOT = "me.boot";
25
25
  * Data passed : none <br>
26
26
  * @public
27
27
  * @constant
28
- * @type String
28
+ * @type {string}
29
29
  * @name STATE_PAUSE
30
30
  * @memberOf me.event
31
31
  * @see me.event.on
@@ -34,10 +34,10 @@ export const STATE_PAUSE = "me.state.onPause";
34
34
 
35
35
  /**
36
36
  * event for when the game is resumed <br>
37
- * Data passed : {Number} time in ms the game was paused
37
+ * Data passed : {number} time in ms the game was paused
38
38
  * @public
39
39
  * @constant
40
- * @type String
40
+ * @type {string}
41
41
  * @name STATE_RESUME
42
42
  * @memberOf me.event
43
43
  * @see me.event.on
@@ -49,7 +49,7 @@ export const STATE_RESUME = "me.state.onResume";
49
49
  * Data passed : none <br>
50
50
  * @public
51
51
  * @constant
52
- * @type String
52
+ * @type {string}
53
53
  * @name STATE_STOP
54
54
  * @memberOf me.event
55
55
  * @see me.event.on
@@ -58,10 +58,10 @@ export const STATE_STOP = "me.state.onStop";
58
58
 
59
59
  /**
60
60
  * event for when the game is restarted <br>
61
- * Data passed : {Number} time in ms the game was stopped
61
+ * Data passed : {number} time in ms the game was stopped
62
62
  * @public
63
63
  * @constant
64
- * @type String
64
+ * @type {string}
65
65
  * @name STATE_RESTART
66
66
  * @memberOf me.event
67
67
  * @see me.event.on
@@ -73,7 +73,7 @@ export const STATE_RESTART = "me.state.onRestart";
73
73
  * Data passed : none <br>
74
74
  * @public
75
75
  * @constant
76
- * @type String
76
+ * @type {string}
77
77
  * @name VIDEO_INIT
78
78
  * @memberOf me.event
79
79
  * @see me.video.init
@@ -86,7 +86,7 @@ export const VIDEO_INIT = "me.video.onInit";
86
86
  * Data passed : none <br>
87
87
  * @public
88
88
  * @constant
89
- * @type String
89
+ * @type {string}
90
90
  * @name GAME_INIT
91
91
  * @memberOf me.event
92
92
  * @see me.event.on
@@ -98,7 +98,7 @@ export const GAME_INIT = "me.game.onInit";
98
98
  * Data passed : none <br>
99
99
  * @public
100
100
  * @constant
101
- * @type String
101
+ * @type {string}
102
102
  * @name GAME_RESET
103
103
  * @memberOf me.event
104
104
  * @see me.event.on
@@ -107,10 +107,10 @@ export const GAME_RESET = "me.game.onReset";
107
107
 
108
108
  /**
109
109
  * event for when the engine is about to start a new game loop
110
- * Data passed : {Number} time the current time stamp
110
+ * Data passed : {number} time the current time stamp
111
111
  * @public
112
112
  * @constant
113
- * @type String
113
+ * @type {string}
114
114
  * @name GAME_BEFORE_UPDATE
115
115
  * @memberOf me.event
116
116
  * @see me.event.on
@@ -119,10 +119,10 @@ export const GAME_BEFORE_UPDATE = "me.game.beforeUpdate";
119
119
 
120
120
  /**
121
121
  * event for the end of the update loop
122
- * Data passed : {Number} time the current time stamp
122
+ * Data passed : {number} time the current time stamp
123
123
  * @public
124
124
  * @constant
125
- * @type String
125
+ * @type {string}
126
126
  * @name GAME_AFTER_UPDATE
127
127
  * @memberOf me.event
128
128
  * @see me.event.on
@@ -131,10 +131,10 @@ export const GAME_AFTER_UPDATE = "me.game.afterUpdate";
131
131
 
132
132
  /**
133
133
  * Event for when the game is updated (will be impacted by frame skip, frame interpolation and pause/resume state) <br>
134
- * Data passed : {Number} time the current time stamp
134
+ * Data passed : {number} time the current time stamp
135
135
  * @public
136
136
  * @constant
137
- * @type String
137
+ * @type {string}
138
138
  * @name GAME_UPDATE
139
139
  * @memberOf me.event
140
140
  * @see me.event.on
@@ -143,10 +143,10 @@ export const GAME_UPDATE = "me.game.onUpdate";
143
143
 
144
144
  /**
145
145
  * Event for the end of the draw loop
146
- * Data passed : {Number} time the current time stamp
146
+ * Data passed : {number} time the current time stamp
147
147
  * @public
148
148
  * @constant
149
- * @type String
149
+ * @type {string}
150
150
  * @name GAME_BEFORE_DRAW
151
151
  * @memberOf me.event
152
152
  * @see me.event.on
@@ -155,10 +155,10 @@ export const GAME_BEFORE_DRAW = "me.game.beforeDraw";
155
155
 
156
156
  /**
157
157
  * Event for the start of the draw loop
158
- * Data passed : {Number} time the current time stamp
158
+ * Data passed : {number} time the current time stamp
159
159
  * @public
160
160
  * @constant
161
- * @type String
161
+ * @type {string}
162
162
  * @name GAME_AFTER_DRAW
163
163
  * @memberOf me.event
164
164
  * @see me.event.on
@@ -167,10 +167,10 @@ export const GAME_AFTER_DRAW = "me.game.afterDraw";
167
167
 
168
168
  /**
169
169
  * Event for when a level is loaded <br>
170
- * Data passed : {String} Level Name
170
+ * Data passed : {string} Level Name
171
171
  * @public
172
172
  * @constant
173
- * @type String
173
+ * @type {string}
174
174
  * @name LEVEL_LOADED
175
175
  * @memberOf me.event
176
176
  * @see me.event.on
@@ -182,7 +182,7 @@ export const LEVEL_LOADED = "me.game.onLevelLoaded";
182
182
  * Data passed : none <br>
183
183
  * @public
184
184
  * @constant
185
- * @type String
185
+ * @type {string}
186
186
  * @name LOADER_COMPLETE
187
187
  * @memberOf me.event
188
188
  * @see me.event.on
@@ -191,10 +191,10 @@ export const LOADER_COMPLETE = "me.loader.onload";
191
191
 
192
192
  /**
193
193
  * Event for displaying a load progress indicator <br>
194
- * Data passed : {Number} [0 .. 1], {Resource} resource object<br>
194
+ * Data passed : {number} [0 .. 1], {Resource} resource object<br>
195
195
  * @public
196
196
  * @constant
197
- * @type String
197
+ * @type {string}
198
198
  * @name LOADER_PROGRESS
199
199
  * @memberOf me.event
200
200
  * @see me.event.on
@@ -203,15 +203,15 @@ export const LOADER_PROGRESS = "me.loader.onProgress";
203
203
 
204
204
  /**
205
205
  * Event for pressing a binded key <br>
206
- * Data passed : {String} user-defined action, {Number} keyCode,
207
- * {Boolean} edge state <br>
206
+ * Data passed : {string} user-defined action, {number} keyCode,
207
+ * {boolean} edge state <br>
208
208
  * Edge-state is for detecting "locked" key bindings. When a locked key
209
209
  * is pressed and held, the first event will have the third argument
210
210
  * set true. Subsequent events will continue firing with the third
211
211
  * argument set false.
212
212
  * @public
213
213
  * @constant
214
- * @type String
214
+ * @type {string}
215
215
  * @name KEYDOWN
216
216
  * @memberOf me.event
217
217
  * @see me.event.on
@@ -234,10 +234,10 @@ export const KEYDOWN = "me.input.keydown";
234
234
 
235
235
  /**
236
236
  * Event for releasing a binded key <br>
237
- * Data passed : {String} user-defined action, {Number} keyCode
237
+ * Data passed : {string} user-defined action, {number} keyCode
238
238
  * @public
239
239
  * @constant
240
- * @type String
240
+ * @type {string}
241
241
  * @name KEYUP
242
242
  * @memberOf me.event
243
243
  * @see me.event.on
@@ -258,10 +258,10 @@ export const KEYUP = "me.input.keyup";
258
258
 
259
259
  /**
260
260
  * Event for when a gamepad is connected <br>
261
- * Data passed : {Object} gamepad object
261
+ * Data passed : {object} gamepad object
262
262
  * @public
263
263
  * @constant
264
- * @type String
264
+ * @type {string}
265
265
  * @name GAMEPAD_CONNECTED
266
266
  * @memberOf me.event
267
267
  * @see me.event.on
@@ -270,10 +270,10 @@ export const GAMEPAD_CONNECTED = "gamepad.connected";
270
270
 
271
271
  /**
272
272
  * Event for when a gamepad is disconnected <br>
273
- * Data passed : {Object} gamepad object
273
+ * Data passed : {object} gamepad object
274
274
  * @public
275
275
  * @constant
276
- * @type String
276
+ * @type {string}
277
277
  * @name GAMEPAD_DISCONNECTED
278
278
  * @memberOf me.event
279
279
  * @see me.event.on
@@ -282,14 +282,14 @@ export const GAMEPAD_DISCONNECTED = "gamepad.disconnected";
282
282
 
283
283
  /**
284
284
  * Event for when gamepad button/axis state is updated <br>
285
- * Data passed : {Number} index <br>
286
- * Data passed : {String} type : "axes" or "buttons" <br>
287
- * Data passed : {Number} button <br>
288
- * Data passed : {Number} current.value <br>
289
- * Data passed : {Boolean} current.pressed
285
+ * Data passed : {number} index <br>
286
+ * Data passed : {string} type : "axes" or "buttons" <br>
287
+ * Data passed : {number} button <br>
288
+ * Data passed : {number} current.value <br>
289
+ * Data passed : {boolean} current.pressed
290
290
  * @public
291
291
  * @constant
292
- * @type String
292
+ * @type {string}
293
293
  * @name GAMEPAD_UPDATE
294
294
  * @memberOf me.event
295
295
  * @see me.event.on
@@ -301,7 +301,7 @@ export const GAMEPAD_UPDATE = "gamepad.update";
301
301
  * Data passed : {me.Pointer} a Pointer object
302
302
  * @public
303
303
  * @constant
304
- * @type String
304
+ * @type {string}
305
305
  * @name POINTERMOVE
306
306
  * @memberOf me.event
307
307
  * @see me.event.on
@@ -311,11 +311,11 @@ export const POINTERMOVE = "me.event.pointermove";
311
311
  /**
312
312
  * Event for dragstart events on a Draggable entity <br>
313
313
  * Data passed:
314
- * {Object} the drag event <br>
315
- * {Object} the Draggable entity
314
+ * {object} the drag event <br>
315
+ * {object} the Draggable entity
316
316
  * @public
317
317
  * @constant
318
- * @type String
318
+ * @type {string}
319
319
  * @name DRAGSTART
320
320
  * @memberOf me.event
321
321
  * @see me.event.on
@@ -325,11 +325,11 @@ export const DRAGSTART = "me.game.dragstart";
325
325
  /**
326
326
  * Event for dragend events on a Draggable entity <br>
327
327
  * Data passed:
328
- * {Object} the drag event <br>
329
- * {Object} the Draggable entity
328
+ * {object} the drag event <br>
329
+ * {object} the Draggable entity
330
330
  * @public
331
331
  * @constant
332
- * @type String
332
+ * @type {string}
333
333
  * @name DRAGEND
334
334
  * @memberOf me.event
335
335
  * @see me.event.on
@@ -341,7 +341,7 @@ export const DRAGEND = "me.game.dragend";
341
341
  * Data passed : {Event} Event object
342
342
  * @public
343
343
  * @constant
344
- * @type String
344
+ * @type {string}
345
345
  * @name WINDOW_ONRESIZE
346
346
  * @memberOf me.event
347
347
  * @see me.event.on
@@ -351,11 +351,11 @@ export const WINDOW_ONRESIZE = "window.onresize";
351
351
  /**
352
352
  * Event for when the canvas is resized <br>
353
353
  * (this usually follows a WINDOW_ONRESIZE event).<br>
354
- * Data passed : {Number} canvas width <br>
355
- * Data passed : {Number} canvas height
354
+ * Data passed : {number} canvas width <br>
355
+ * Data passed : {number} canvas height
356
356
  * @public
357
357
  * @constant
358
- * @type String
358
+ * @type {string}
359
359
  * @name CANVAS_ONRESIZE
360
360
  * @memberOf me.event
361
361
  * @see me.event.on
@@ -365,11 +365,11 @@ export const CANVAS_ONRESIZE = "canvas.onresize";
365
365
  /**
366
366
  * Event for when the viewport is resized <br>
367
367
  * (this usually follows a WINDOW_ONRESIZE event, when using the `flex` scaling mode is used and after the viewport was updated).<br>
368
- * Data passed : {Number} viewport width <br>
369
- * Data passed : {Number} viewport height
368
+ * Data passed : {number} viewport width <br>
369
+ * Data passed : {number} viewport height
370
370
  * @public
371
371
  * @constant
372
- * @type String
372
+ * @type {string}
373
373
  * @name VIEWPORT_ONRESIZE
374
374
  * @memberOf me.event
375
375
  * @see me.event.on
@@ -381,7 +381,7 @@ export const VIEWPORT_ONRESIZE = "viewport.onresize";
381
381
  * Data passed : {Event} Event object <br>
382
382
  * @public
383
383
  * @constant
384
- * @type String
384
+ * @type {string}
385
385
  * @name WINDOW_ONORIENTATION_CHANGE
386
386
  * @memberOf me.event
387
387
  * @see me.event.on
@@ -393,7 +393,7 @@ export const WINDOW_ONORIENTATION_CHANGE = "window.orientationchange";
393
393
  * Data passed : {Event} Event object
394
394
  * @public
395
395
  * @constant
396
- * @type String
396
+ * @type {string}
397
397
  * @name WINDOW_ONSCROLL
398
398
  * @memberOf me.event
399
399
  * @see me.event.on
@@ -405,7 +405,7 @@ export const WINDOW_ONSCROLL = "window.onscroll";
405
405
  * Data passed : {me.Vector2d} viewport position vector
406
406
  * @public
407
407
  * @constant
408
- * @type String
408
+ * @type {string}
409
409
  * @name VIEWPORT_ONCHANGE
410
410
  * @memberOf me.event
411
411
  * @see me.event.on
@@ -417,7 +417,7 @@ export const VIEWPORT_ONCHANGE = "viewport.onchange";
417
417
  * Data passed : {me.WebGLRenderer} the current webgl renderer instance`
418
418
  * @public
419
419
  * @constant
420
- * @type String
420
+ * @type {string}
421
421
  * @name WEBGL_ONCONTEXT_LOST
422
422
  * @memberOf me.event
423
423
  * @see me.event.on
@@ -429,7 +429,7 @@ export const WEBGL_ONCONTEXT_LOST = "renderer.webglcontextlost";
429
429
  * Data passed : {me.WebGLRenderer} the current webgl renderer instance`
430
430
  * @public
431
431
  * @constant
432
- * @type String
432
+ * @type {string}
433
433
  * @name WEBGL_ONCONTEXT_RESTORED
434
434
  * @memberOf me.event
435
435
  * @see me.event.on
@@ -439,9 +439,9 @@ export const WEBGL_ONCONTEXT_RESTORED = "renderer.webglcontextrestored";
439
439
  /**
440
440
  * calls each of the listeners registered for a given event.
441
441
  * @function me.event.emit
442
- * @param {(String|Symbol)} event The event name.
443
- * @param {...*} arguments arguments to be passed to all listeners
444
- * @return true if the event had listeners, false otherwise.
442
+ * @param {string|symbol} eventName The event name.
443
+ * @param {object} [...arguments] arguments to be passed to all listeners
444
+ * @returns {boolean} true if the event had listeners, false otherwise.
445
445
  * @example
446
446
  * me.event.emit("event-name", a, b, c);
447
447
  */
@@ -452,8 +452,8 @@ export function emit(eventName, ...args) {
452
452
  /**
453
453
  * Add a listener for a given event.
454
454
  * @function me.event.on
455
- * @param {(String|Symbol)} event The event name.
456
- * @param {Function} fn The listener function.
455
+ * @param {string|symbol} eventName The event name.
456
+ * @param {Function} listener The listener function.
457
457
  * @param {*} [context=this] The context to invoke the listener with.
458
458
  * @returns {EventEmitter} `this`.
459
459
  * @public
@@ -467,8 +467,8 @@ export function on(eventName, listener, context) {
467
467
  /**
468
468
  * Add a one-time listener for a given event.
469
469
  * @function me.event.once
470
- * @param {(String|Symbol)} event The event name.
471
- * @param {Function} fn The listener function.
470
+ * @param {string|symbol} eventName The event name.
471
+ * @param {Function} listener The listener function.
472
472
  * @param {*} [context=this] The context to invoke the listener with.
473
473
  * @returns {EventEmitter} `this`.
474
474
  * @public
@@ -482,8 +482,8 @@ export function once(eventName, listener, context) {
482
482
  /**
483
483
  * remove the given listener for a given event.
484
484
  * @function me.event.off
485
- * @param {(String|Symbol)} event The event name.
486
- * @param {Function} fn The listener function.
485
+ * @param {string|symbol} eventName The event name.
486
+ * @param {Function} listener The listener function.
487
487
  * @returns {EventEmitter} `this`.
488
488
  * @public
489
489
  * @example
@@ -23,9 +23,9 @@ var pool = {
23
23
  * Pooling must be set to true if more than one such objects will be created. <br>
24
24
  * (Note: for an object to be poolable, it must implements a `onResetEvent` method)
25
25
  * @function me.pool.register
26
- * @param {String} className as defined in the Name field of the Object Properties (in Tiled)
27
- * @param {Object} class corresponding Class to be instantiated
28
- * @param {Boolean} [recycling=false] enables object recycling for the specified class
26
+ * @param {string} className as defined in the Name field of the Object Properties (in Tiled)
27
+ * @param {object} classObj corresponding Class to be instantiated
28
+ * @param {boolean} [recycling=false] enables object recycling for the specified class
29
29
  * @example
30
30
  * // implement CherryEntity
31
31
  * class CherryEntity extends Spritesheet {
@@ -51,9 +51,9 @@ var pool = {
51
51
  /**
52
52
  * Pull a new instance of the requested object (if added into the object pool)
53
53
  * @function me.pool.pull
54
- * @param {String} className as used in {@link me.pool.register}
55
- * @param {} [arguments...] arguments to be passed when instantiating/reinitializing the object
56
- * @return {Object} the instance of the requested object
54
+ * @param {string} name as used in {@link me.pool.register}
55
+ * @param {object} [...arguments] arguments to be passed when instantiating/reinitializing the object
56
+ * @returns {object} the instance of the requested object
57
57
  * @example
58
58
  * me.pool.register("bullet", BulletEntity, true);
59
59
  * me.pool.register("enemy", EnemyEntity, true);
@@ -125,9 +125,9 @@ var pool = {
125
125
  * otherwise this function won't work
126
126
  * @function me.pool.push
127
127
  * @throws will throw an error if the object cannot be recycled
128
- * @param {Object} instance to be recycled
129
- * @param {Boolean} [throwOnError=true] throw an exception if the object cannot be recycled
130
- * @return {Boolean} true if the object was successfully recycled in the object pool
128
+ * @param {object} obj instance to be recycled
129
+ * @param {boolean} [throwOnError=true] throw an exception if the object cannot be recycled
130
+ * @returns {boolean} true if the object was successfully recycled in the object pool
131
131
  */
132
132
  push(obj, throwOnError = true) {
133
133
  if (!this.poolable(obj)) {
@@ -148,8 +148,8 @@ var pool = {
148
148
  /**
149
149
  * Check if an object with the provided name is registered
150
150
  * @function me.pool.exists
151
- * @param {String} name of the registered object class
152
- * @return {Boolean} true if the classname is registered
151
+ * @param {string} name of the registered object class
152
+ * @returns {boolean} true if the classname is registered
153
153
  */
154
154
  exists(name) {
155
155
  return name in objectClass;
@@ -160,8 +160,8 @@ var pool = {
160
160
  * (was properly registered with the recycling feature enable)
161
161
  * @function me.pool.poolable
162
162
  * @see me.pool.register
163
- * @param {Object} object
164
- * @return {Boolean} true if the object is poolable
163
+ * @param {object} obj object to be checked
164
+ * @returns {boolean} true if the object is poolable
165
165
  * @example
166
166
  * if (!me.pool.poolable(myCherryEntity)) {
167
167
  * // object was not properly registered
@@ -179,7 +179,7 @@ var pool = {
179
179
  /**
180
180
  * returns the amount of object instance currently in the pool
181
181
  * @function me.pool.getInstanceCount
182
- * @return {Number} amount of object instance
182
+ * @returns {number} amount of object instance
183
183
  */
184
184
  getInstanceCount() {
185
185
  return instance_counter;
@@ -36,7 +36,10 @@ import * as event from "./../system/event.js";
36
36
  // Variable to hold the object data
37
37
  var data = {};
38
38
 
39
- // a function to check if the given key is a reserved word
39
+ /**
40
+ * a function to check if the given key is a reserved word
41
+ * @ignore
42
+ */
40
43
  function isReserved(key) {
41
44
  return (key === "add" || key === "remove");
42
45
  }
@@ -64,7 +67,7 @@ var save = {
64
67
  * @name add
65
68
  * @memberOf me.save
66
69
  * @function
67
- * @param {Object} props key and corresponding values
70
+ * @param {object} props key and corresponding values
68
71
  * @example
69
72
  * // Initialize "score" and "lives" with default values
70
73
  * me.save.add({ score : 0, lives : 3 });
@@ -118,7 +121,7 @@ var save = {
118
121
  * @name remove
119
122
  * @memberOf me.save
120
123
  * @function
121
- * @param {String} key key to be removed
124
+ * @param {string} key key to be removed
122
125
  * @example
123
126
  * // Remove the "score" key from localStorage
124
127
  * me.save.remove("score");
@@ -100,7 +100,7 @@ var timer = {
100
100
  * use it.
101
101
  * @public
102
102
  * @see me.timer.interpolation
103
- * @type {Number}
103
+ * @type {number}
104
104
  * @name tick
105
105
  * @memberOf me.timer
106
106
  */
@@ -110,7 +110,7 @@ var timer = {
110
110
  * Last measured fps rate.<br/>
111
111
  * This feature is disabled by default, unless the debugPanel is enabled/visible
112
112
  * @public
113
- * @type {Number}
113
+ * @type {number}
114
114
  * @name fps
115
115
  * @memberOf me.timer
116
116
  */
@@ -120,7 +120,7 @@ var timer = {
120
120
  * Set the maximum target display frame per second
121
121
  * @public
122
122
  * @see me.timer.tick
123
- * @type {Number}
123
+ * @type {number}
124
124
  * @name maxfps
125
125
  * @default 60
126
126
  * @memberOf me.timer
@@ -130,7 +130,7 @@ var timer = {
130
130
  /**
131
131
  * Enable/disable frame interpolation
132
132
  * @see me.timer.tick
133
- * @type {Boolean}
133
+ * @type {boolean}
134
134
  * @default false
135
135
  * @name interpolation
136
136
  * @memberOf me.timer
@@ -161,10 +161,10 @@ var timer = {
161
161
  * @name setTimeout
162
162
  * @memberOf me.timer
163
163
  * @param {Function} fn the function you want to execute after delay milliseconds.
164
- * @param {Number} delay the number of milliseconds (thousandths of a second) that the function call should be delayed by.
165
- * @param {Boolean} [pauseable=true] respects the pause state of the engine.
166
- * @param {...*} [param] optional parameters which are passed through to the function specified by fn once the timer expires.
167
- * @return {Number} The numerical ID of the timer, which can be used later with me.timer.clearTimeout().
164
+ * @param {number} delay the number of milliseconds (thousandths of a second) that the function call should be delayed by.
165
+ * @param {boolean} [pauseable=true] respects the pause state of the engine.
166
+ * @param {object} [args] optional parameters which are passed through to the function specified by fn once the timer expires.
167
+ * @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearTimeout().
168
168
  * @function
169
169
  * @example
170
170
  * // set a timer to call "myFunction" after 1000ms
@@ -172,7 +172,7 @@ var timer = {
172
172
  * // set a timer to call "myFunction" after 1000ms (respecting the pause state) and passing param1 and param2
173
173
  * me.timer.setTimeout(myFunction, 1000, true, param1, param2);
174
174
  */
175
- setTimeout(fn, delay, pauseable) {
175
+ setTimeout(fn, delay, pauseable, ...args) {
176
176
  timers.push({
177
177
  fn : fn,
178
178
  delay : delay,
@@ -180,7 +180,7 @@ var timer = {
180
180
  repeat : false,
181
181
  timerId : ++timerId,
182
182
  pauseable : pauseable === true || true,
183
- args : arguments.length > 3 ? Array.prototype.slice.call(arguments, 3) : undefined
183
+ args : args
184
184
  });
185
185
  return timerId;
186
186
  },
@@ -190,10 +190,10 @@ var timer = {
190
190
  * @name setInterval
191
191
  * @memberOf me.timer
192
192
  * @param {Function} fn the function to execute
193
- * @param {Number} delay the number of milliseconds (thousandths of a second) on how often to execute the function
194
- * @param {Boolean} [pauseable=true] respects the pause state of the engine.
195
- * @param {...*} [param] optional parameters which are passed through to the function specified by fn once the timer expires.
196
- * @return {Number} The numerical ID of the timer, which can be used later with me.timer.clearInterval().
193
+ * @param {number} delay the number of milliseconds (thousandths of a second) on how often to execute the function
194
+ * @param {boolean} [pauseable=true] respects the pause state of the engine.
195
+ * @param {object} [args] optional parameters which are passed through to the function specified by fn once the timer expires.
196
+ * @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearInterval().
197
197
  * @function
198
198
  * @example
199
199
  * // set a timer to call "myFunction" every 1000ms
@@ -201,7 +201,7 @@ var timer = {
201
201
  * // set a timer to call "myFunction" every 1000ms (respecting the pause state) and passing param1 and param2
202
202
  * me.timer.setInterval(myFunction, 1000, true, param1, param2);
203
203
  */
204
- setInterval(fn, delay, pauseable) {
204
+ setInterval(fn, delay, pauseable, ...args) {
205
205
  timers.push({
206
206
  fn : fn,
207
207
  delay : delay,
@@ -209,7 +209,7 @@ var timer = {
209
209
  repeat : true,
210
210
  timerId : ++timerId,
211
211
  pauseable : pauseable === true || true,
212
- args : arguments.length > 3 ? Array.prototype.slice.call(arguments, 3) : undefined
212
+ args : args
213
213
  });
214
214
  return timerId;
215
215
  },
@@ -219,7 +219,7 @@ var timer = {
219
219
  * @name clearTimeout
220
220
  * @memberOf me.timer
221
221
  * @function
222
- * @param {Number} timeoutID ID of the timeout to be cleared
222
+ * @param {number} timeoutID ID of the timeout to be cleared
223
223
  */
224
224
  clearTimeout(timeoutID) {
225
225
  utils.function.defer(clearTimer, this, timeoutID);
@@ -230,7 +230,7 @@ var timer = {
230
230
  * @name clearInterval
231
231
  * @memberOf me.timer
232
232
  * @function
233
- * @param {Number} intervalID ID of the interval to be cleared
233
+ * @param {number} intervalID ID of the interval to be cleared
234
234
  */
235
235
  clearInterval(intervalID) {
236
236
  utils.function.defer(clearTimer, this, intervalID);
@@ -241,7 +241,7 @@ var timer = {
241
241
  * since the game has started or since linux epoch (based on browser support for High Resolution Timer)
242
242
  * @name getTime
243
243
  * @memberOf me.timer
244
- * @return {Number}
244
+ * @returns {number}
245
245
  * @function
246
246
  */
247
247
  getTime() {
@@ -252,7 +252,7 @@ var timer = {
252
252
  * Return elapsed time in milliseconds since the last update
253
253
  * @name getDelta
254
254
  * @memberOf me.timer
255
- * @return {Number}
255
+ * @returns {number}
256
256
  * @function
257
257
  */
258
258
  getDelta() {