melonjs 15.1.6 → 15.2.0
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.
- package/README.md +2 -2
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/application/application.js +3 -3
- package/dist/melonjs.mjs/application/header.js +1 -1
- package/dist/melonjs.mjs/application/resize.js +1 -1
- package/dist/melonjs.mjs/application/settings.js +1 -1
- package/dist/melonjs.mjs/audio/audio.js +1 -1
- package/dist/melonjs.mjs/camera/camera2d.js +1 -1
- package/dist/melonjs.mjs/const.js +1 -1
- package/dist/melonjs.mjs/entity/entity.js +1 -1
- package/dist/melonjs.mjs/geometries/ellipse.js +1 -1
- package/dist/melonjs.mjs/geometries/line.js +1 -1
- package/dist/melonjs.mjs/geometries/path2d.js +1 -1
- package/dist/melonjs.mjs/geometries/point.js +1 -1
- package/dist/melonjs.mjs/geometries/poly.js +1 -1
- package/dist/melonjs.mjs/geometries/rectangle.js +1 -1
- package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
- package/dist/melonjs.mjs/index.js +10 -6
- package/dist/melonjs.mjs/input/gamepad.js +1 -1
- package/dist/melonjs.mjs/input/input.js +1 -1
- package/dist/melonjs.mjs/input/keyboard.js +1 -1
- package/dist/melonjs.mjs/input/pointer.js +1 -1
- package/dist/melonjs.mjs/input/pointerevent.js +1 -1
- package/dist/melonjs.mjs/lang/console.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +1 -1
- package/dist/melonjs.mjs/level/level.js +5 -4
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +3 -3
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +6 -8
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
- package/dist/melonjs.mjs/loader/cache.js +1 -1
- package/dist/melonjs.mjs/loader/loader.js +1 -1
- package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parser.js +1 -1
- package/dist/melonjs.mjs/loader/settings.js +1 -1
- package/dist/melonjs.mjs/math/color.js +1 -1
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +1 -1
- package/dist/melonjs.mjs/math/matrix3.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector2.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector3.js +1 -1
- package/dist/melonjs.mjs/math/vector2.js +1 -1
- package/dist/melonjs.mjs/math/vector3.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +1 -1
- package/dist/melonjs.mjs/particles/particle.js +1 -1
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +1 -1
- package/dist/melonjs.mjs/physics/bounds.js +1 -1
- package/dist/melonjs.mjs/physics/collision.js +1 -1
- package/dist/melonjs.mjs/physics/detector.js +1 -1
- package/dist/melonjs.mjs/physics/quadtree.js +1 -1
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +1 -1
- package/dist/melonjs.mjs/physics/world.js +1 -1
- package/dist/melonjs.mjs/plugin/plugin.js +106 -108
- package/dist/melonjs.mjs/renderable/collectable.js +1 -1
- package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
- package/dist/melonjs.mjs/renderable/container.js +7 -6
- package/dist/melonjs.mjs/renderable/draggable.js +1 -1
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +1 -1
- package/dist/melonjs.mjs/renderable/light2d.js +1 -1
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
- package/dist/melonjs.mjs/renderable/renderable.js +1 -1
- package/dist/melonjs.mjs/renderable/sprite.js +1 -1
- package/dist/melonjs.mjs/renderable/trigger.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +1 -1
- package/dist/melonjs.mjs/state/stage.js +1 -1
- package/dist/melonjs.mjs/state/state.js +1 -1
- package/dist/melonjs.mjs/system/device.js +1 -1
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +1 -1
- package/dist/melonjs.mjs/system/platform.js +1 -1
- package/dist/melonjs.mjs/system/pooling.js +1 -1
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +4 -4
- package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +1 -1
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +1 -1
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +1 -1
- package/dist/melonjs.mjs/utils/string.js +1 -1
- package/dist/melonjs.mjs/utils/utils.js +105 -111
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +1 -1
- package/dist/melonjs.mjs/video/renderer.js +1 -1
- package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +1 -1
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +4 -4
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1 -1
- package/dist/melonjs.module.js +460 -449
- package/dist/types/index.d.ts +3 -3
- package/dist/types/plugin/plugin.d.ts +60 -5
- package/dist/types/utils/utils.d.ts +56 -17
- package/package.json +3 -3
- package/src/application/application.js +2 -2
- package/src/index.js +3 -2
- package/src/level/level.js +4 -3
- package/src/level/tiled/TMXTileMap.js +2 -2
- package/src/level/tiled/TMXUtils.js +4 -3
- package/src/plugin/plugin.js +103 -105
- package/src/renderable/container.js +6 -5
- package/src/system/timer.js +3 -3
- package/src/utils/utils.js +102 -111
- package/src/video/video.js +3 -3
|
@@ -1,141 +1,139 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.2.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
6
6
|
* @copyright (C) 2011 - 2023 Olivier Biot (AltByte Pte Ltd)
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { checkVersion } from '../utils/utils.js';
|
|
9
9
|
import { version } from '../index.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
12
|
+
* Contains all registered plugins.
|
|
13
|
+
* @name cache
|
|
14
|
+
* @memberof plugin
|
|
15
15
|
*/
|
|
16
|
-
let
|
|
16
|
+
let cache = {};
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @namespace plugin
|
|
20
|
+
*/
|
|
18
21
|
|
|
22
|
+
/**
|
|
23
|
+
* a base Object class for plugin
|
|
24
|
+
* (plugin must be installed using the register function)
|
|
25
|
+
* @class
|
|
26
|
+
* @name BasePlugin
|
|
27
|
+
* @memberof plugin
|
|
28
|
+
*/
|
|
19
29
|
class BasePlugin {
|
|
20
30
|
|
|
21
31
|
constructor() {
|
|
22
32
|
/**
|
|
23
33
|
* define the minimum required version of melonJS<br>
|
|
24
34
|
* this can be overridden by the plugin
|
|
25
|
-
* @public
|
|
26
35
|
* @type {string}
|
|
27
|
-
* @default "15.
|
|
28
|
-
* @name plugin.Base#version
|
|
36
|
+
* @default "15.2.0"
|
|
29
37
|
*/
|
|
30
|
-
this.version = "15.
|
|
38
|
+
this.version = "15.2.0";
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
|
|
42
|
+
|
|
34
43
|
/**
|
|
35
|
-
* @
|
|
44
|
+
* @class
|
|
45
|
+
* @name Base
|
|
46
|
+
* @memberof plugin
|
|
47
|
+
* @deprecated since 15.1.6, see {@link plugin.BasePlugin}
|
|
36
48
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* a base Object for plugin <br>
|
|
41
|
-
* plugin must be installed using the register function
|
|
42
|
-
* @see plugin
|
|
43
|
-
* @class
|
|
44
|
-
* @name Base
|
|
45
|
-
* @memberof plugin
|
|
46
|
-
*/
|
|
47
|
-
Base : BasePlugin,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* patch a melonJS function
|
|
51
|
-
* @name patch
|
|
52
|
-
* @memberof plugin
|
|
53
|
-
* @public
|
|
54
|
-
* @param {object} proto - target object
|
|
55
|
-
* @param {string} name - target function
|
|
56
|
-
* @param {Function} fn - replacement function
|
|
57
|
-
* @example
|
|
58
|
-
* // redefine the me.game.update function with a new one
|
|
59
|
-
* me.plugin.patch(me.game, "update", function () {
|
|
60
|
-
* // display something in the console
|
|
61
|
-
* console.log("duh");
|
|
62
|
-
* // call the original me.game.update function
|
|
63
|
-
* this._patched();
|
|
64
|
-
* });
|
|
65
|
-
*/
|
|
66
|
-
patch : function (proto, name, fn) {
|
|
67
|
-
// use the object prototype if possible
|
|
68
|
-
if (typeof proto.prototype !== "undefined") {
|
|
69
|
-
proto = proto.prototype;
|
|
70
|
-
}
|
|
71
|
-
// reuse the logic behind object extends
|
|
72
|
-
if (typeof(proto[name]) === "function") {
|
|
73
|
-
// save the original function
|
|
74
|
-
let _parent = proto[name];
|
|
75
|
-
// override the function with the new one
|
|
76
|
-
Object.defineProperty(proto, name, {
|
|
77
|
-
"configurable" : true,
|
|
78
|
-
"value" : (function (name, fn) {
|
|
79
|
-
return function () {
|
|
80
|
-
this._patched = _parent;
|
|
81
|
-
let ret = fn.apply(this, arguments);
|
|
82
|
-
this._patched = null;
|
|
83
|
-
return ret;
|
|
84
|
-
};
|
|
85
|
-
})(name, fn)
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
throw new Error(name + " is not an existing function");
|
|
90
|
-
}
|
|
91
|
-
},
|
|
49
|
+
class Base extends BasePlugin {}
|
|
92
50
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
51
|
+
/**
|
|
52
|
+
* patch a melonJS function
|
|
53
|
+
* @name patch
|
|
54
|
+
* @memberof plugin
|
|
55
|
+
* @param {object} proto - target object
|
|
56
|
+
* @param {string} name - target function
|
|
57
|
+
* @param {Function} fn - replacement function
|
|
58
|
+
* @example
|
|
59
|
+
* // redefine the me.game.update function with a new one
|
|
60
|
+
* me.plugin.patch(me.game, "update", function () {
|
|
61
|
+
* // display something in the console
|
|
62
|
+
* console.log("duh");
|
|
63
|
+
* // call the original me.game.update function
|
|
64
|
+
* this._patched();
|
|
65
|
+
* });
|
|
66
|
+
*/
|
|
67
|
+
function patch(proto, name, fn) {
|
|
68
|
+
// use the object prototype if possible
|
|
69
|
+
if (typeof proto.prototype !== "undefined") {
|
|
70
|
+
proto = proto.prototype;
|
|
71
|
+
}
|
|
72
|
+
// reuse the logic behind object extends
|
|
73
|
+
if (typeof(proto[name]) === "function") {
|
|
74
|
+
// save the original function
|
|
75
|
+
let _parent = proto[name];
|
|
76
|
+
// override the function with the new one
|
|
77
|
+
Object.defineProperty(proto, name, {
|
|
78
|
+
"configurable" : true,
|
|
79
|
+
"value" : (function (name, fn) {
|
|
80
|
+
return function () {
|
|
81
|
+
this._patched = _parent;
|
|
82
|
+
let ret = fn.apply(this, arguments);
|
|
83
|
+
this._patched = null;
|
|
84
|
+
return ret;
|
|
85
|
+
};
|
|
86
|
+
})(name, fn)
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
throw new Error(name + " is not an existing function");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
114
93
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Register a plugin.
|
|
96
|
+
* @name register
|
|
97
|
+
* @memberof plugin
|
|
98
|
+
* @param {plugin.BasePlugin} plugin - Plugin object to instantiate and register
|
|
99
|
+
* @param {string} [name=plugin.constructor.name] - a unique name for this plugin
|
|
100
|
+
* @param {object} [...arguments] - all extra parameters will be passed to the plugin constructor
|
|
101
|
+
* @example
|
|
102
|
+
* // register a new plugin
|
|
103
|
+
* me.plugin.register(TestPlugin, "testPlugin");
|
|
104
|
+
* // the plugin then also become available
|
|
105
|
+
* // under then me.plugins namespace
|
|
106
|
+
* me.plugins.testPlugin.myfunction ();
|
|
107
|
+
*/
|
|
108
|
+
function register(plugin, name = plugin.toString().match(/ (\w+)/)[1]) {
|
|
109
|
+
// ensure me.plugins[name] is not already "used"
|
|
110
|
+
if (cache[name]) {
|
|
111
|
+
throw new Error("plugin " + name + " already registered");
|
|
112
|
+
}
|
|
121
113
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
114
|
+
// get extra arguments
|
|
115
|
+
let _args = [];
|
|
116
|
+
if (arguments.length > 2) {
|
|
117
|
+
// store extra arguments if any
|
|
118
|
+
_args = Array.prototype.slice.call(arguments, 1);
|
|
119
|
+
}
|
|
125
120
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
121
|
+
// try to instantiate the plugin
|
|
122
|
+
_args[0] = plugin;
|
|
123
|
+
let instance = new (plugin.bind.apply(plugin, _args))();
|
|
130
124
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
// inheritance check
|
|
126
|
+
if (typeof instance === "undefined" || !(instance instanceof BasePlugin)) {
|
|
127
|
+
throw new Error("Plugin should extend the BasePlugin Class !");
|
|
128
|
+
}
|
|
135
129
|
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
// compatibility testing
|
|
131
|
+
if (checkVersion(instance.version, version) > 0) {
|
|
132
|
+
throw new Error("Plugin version mismatch, expected: " + instance.version + ", got: " + version);
|
|
138
133
|
}
|
|
139
|
-
};
|
|
140
134
|
|
|
141
|
-
|
|
135
|
+
// create a reference to the new plugin
|
|
136
|
+
cache[name] = instance;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { Base, BasePlugin, cache, patch, register };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.2.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
6
6
|
* @copyright (C) 2011 - 2023 Olivier Biot (AltByte Pte Ltd)
|
|
7
7
|
*/
|
|
8
8
|
import Renderable from './renderable.js';
|
|
9
|
-
import
|
|
9
|
+
import { createGUID } from '../utils/utils.js';
|
|
10
|
+
import { defer } from '../utils/function.js';
|
|
10
11
|
import { game } from '../index.js';
|
|
11
12
|
import { on, CANVAS_ONRESIZE } from '../system/event.js';
|
|
12
13
|
import pool from '../system/pooling.js';
|
|
@@ -196,7 +197,7 @@ let globalFloatingCounter = 0;
|
|
|
196
197
|
// (e.g. move one child from one container to another)
|
|
197
198
|
if (child.isRenderable) {
|
|
198
199
|
// allocated a GUID value (use child.id as based index if defined)
|
|
199
|
-
child.GUID =
|
|
200
|
+
child.GUID = createGUID(child.id);
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
|
|
@@ -279,7 +280,7 @@ let globalFloatingCounter = 0;
|
|
|
279
280
|
// (e.g. move one child from one container to another)
|
|
280
281
|
if (child.isRenderable) {
|
|
281
282
|
// allocated a GUID value
|
|
282
|
-
child.GUID =
|
|
283
|
+
child.GUID = createGUID();
|
|
283
284
|
}
|
|
284
285
|
}
|
|
285
286
|
|
|
@@ -650,7 +651,7 @@ let globalFloatingCounter = 0;
|
|
|
650
651
|
*/
|
|
651
652
|
removeChild(child, keepalive) {
|
|
652
653
|
if (this.hasChild(child)) {
|
|
653
|
-
|
|
654
|
+
defer(deferredRemove, this, child, keepalive);
|
|
654
655
|
}
|
|
655
656
|
else {
|
|
656
657
|
throw new Error("Child is not mine.");
|
|
@@ -801,7 +802,7 @@ let globalFloatingCounter = 0;
|
|
|
801
802
|
});
|
|
802
803
|
}
|
|
803
804
|
/** @ignore */
|
|
804
|
-
this.pendingSort =
|
|
805
|
+
this.pendingSort = defer(function () {
|
|
805
806
|
// sort everything in this container
|
|
806
807
|
this.getChildren().sort(this["_sort" + this.sortOn.toUpperCase()]);
|
|
807
808
|
// clear the defer id
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.2.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
6
6
|
* @copyright (C) 2011 - 2023 Olivier Biot (AltByte Pte Ltd)
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { defer } from '../utils/function.js';
|
|
9
9
|
import { on, GAME_BEFORE_UPDATE, BOOT, STATE_RESUME, STATE_RESTART, STATE_CHANGE } from './event.js';
|
|
10
10
|
import state from '../state/state.js';
|
|
11
11
|
import { clamp } from '../math/math.js';
|
|
@@ -168,7 +168,7 @@ class Timer {
|
|
|
168
168
|
*/
|
|
169
169
|
clearTimeout(timeoutID) {
|
|
170
170
|
if (timeoutID > 0) {
|
|
171
|
-
|
|
171
|
+
defer(this.clearTimer.bind(this), this, timeoutID);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -178,7 +178,7 @@ class Timer {
|
|
|
178
178
|
*/
|
|
179
179
|
clearInterval(intervalID) {
|
|
180
180
|
if (intervalID > 0) {
|
|
181
|
-
|
|
181
|
+
defer(this.clearTimer.bind(this), this, intervalID);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|