@woosh/meep-engine 2.110.15 → 2.111.1
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/build/meep.cjs +444 -371
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +444 -371
- package/editor/tools/v2/BlenderCameraOrientationGizmo.js +4 -2
- package/package.json +1 -1
- package/src/core/events/signal/Signal.d.ts.map +1 -1
- package/src/core/events/signal/Signal.js +291 -256
- package/src/core/events/signal/SignalHandler.d.ts +7 -2
- package/src/core/events/signal/SignalHandler.d.ts.map +1 -1
- package/src/core/events/signal/SignalHandler.js +12 -6
- package/src/core/events/signal/signal_handler_list_find.d.ts +8 -0
- package/src/core/events/signal/signal_handler_list_find.d.ts.map +1 -0
- package/src/core/events/signal/signal_handler_list_find.js +23 -0
- package/src/core/events/signal/signal_handler_list_last.d.ts +7 -0
- package/src/core/events/signal/signal_handler_list_last.d.ts.map +1 -0
- package/src/core/events/signal/signal_handler_list_last.js +14 -0
- package/src/core/events/signal/signal_handler_list_validate.d.ts +8 -0
- package/src/core/events/signal/signal_handler_list_validate.d.ts.map +1 -0
- package/src/core/events/signal/signal_handler_list_validate.js +29 -0
- package/src/core/model/node-graph/NodeGraph.d.ts +2 -2
- package/src/core/model/node-graph/node/NodeInstance.d.ts +5 -5
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts +2 -3
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts.map +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +3 -3
- package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/Camera.js +2 -2
- package/src/engine/graphics/ecs/camera/CameraSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/CameraSystem.js +10 -2
- package/src/engine/graphics/ecs/camera/quaternion_invert_orientation.d.ts +7 -0
- package/src/engine/graphics/ecs/camera/quaternion_invert_orientation.d.ts.map +1 -0
- package/src/engine/graphics/ecs/camera/{InvertQuaternionOrientation.js → quaternion_invert_orientation.js} +6 -5
- package/src/engine/graphics/ecs/camera/InvertQuaternionOrientation.d.ts +0 -7
- package/src/engine/graphics/ecs/camera/InvertQuaternionOrientation.d.ts.map +0 -1
package/build/meep.cjs
CHANGED
|
@@ -899,6 +899,36 @@ function m4_multiply(out, a, b) {
|
|
|
899
899
|
out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
900
900
|
}
|
|
901
901
|
|
|
902
|
+
/**
|
|
903
|
+
*
|
|
904
|
+
* @param {SignalHandler} first
|
|
905
|
+
* @param {function} handle
|
|
906
|
+
* @param {*} [thisArg]
|
|
907
|
+
*/
|
|
908
|
+
function signal_handler_list_find(first, handle, thisArg) {
|
|
909
|
+
let n = first;
|
|
910
|
+
|
|
911
|
+
for (; ;) {
|
|
912
|
+
|
|
913
|
+
if (n.handle === handle && n.context === thisArg) {
|
|
914
|
+
return n;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
n = n.next;
|
|
918
|
+
|
|
919
|
+
if (n === null) {
|
|
920
|
+
return null;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
const SignalFlags = {
|
|
926
|
+
/**
|
|
927
|
+
* If set - signal will not invoke handlers when dispatched
|
|
928
|
+
*/
|
|
929
|
+
Silent: 1
|
|
930
|
+
};
|
|
931
|
+
|
|
902
932
|
/**
|
|
903
933
|
*
|
|
904
934
|
* @enum {number}
|
|
@@ -911,6 +941,18 @@ const SignalHandlerFlags = {
|
|
|
911
941
|
};
|
|
912
942
|
|
|
913
943
|
class SignalHandler {
|
|
944
|
+
/**
|
|
945
|
+
* Optional field. Used for forming linked lists of handlers
|
|
946
|
+
* @type {SignalHandler|null}
|
|
947
|
+
*/
|
|
948
|
+
next = null;
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* @private
|
|
952
|
+
* @type {number|SignalHandlerFlags}
|
|
953
|
+
*/
|
|
954
|
+
flags = 0;
|
|
955
|
+
|
|
914
956
|
/**
|
|
915
957
|
*
|
|
916
958
|
* @param {function} handle
|
|
@@ -918,15 +960,9 @@ class SignalHandler {
|
|
|
918
960
|
*/
|
|
919
961
|
constructor(handle, context) {
|
|
920
962
|
|
|
921
|
-
|
|
922
963
|
this.handle = handle;
|
|
923
964
|
this.context = context;
|
|
924
965
|
|
|
925
|
-
/**
|
|
926
|
-
* @private
|
|
927
|
-
* @type {number|SignalHandlerFlags}
|
|
928
|
-
*/
|
|
929
|
-
this.flags = 0;
|
|
930
966
|
}
|
|
931
967
|
|
|
932
968
|
/**
|
|
@@ -977,137 +1013,19 @@ class SignalHandler {
|
|
|
977
1013
|
*/
|
|
978
1014
|
SignalHandler.prototype.isSignalHandler = true;
|
|
979
1015
|
|
|
980
|
-
/**
|
|
981
|
-
* Common dispatch stack
|
|
982
|
-
* @readonly
|
|
983
|
-
* @type {SignalHandler[]}
|
|
984
|
-
*/
|
|
985
|
-
const dispatch_stack$1 = [];
|
|
986
|
-
let dispatch_stack_top$1 = 0;
|
|
987
|
-
|
|
988
|
-
/**
|
|
989
|
-
*
|
|
990
|
-
* @param {function} f
|
|
991
|
-
* @param {*} context
|
|
992
|
-
* @param {Array} args
|
|
993
|
-
*/
|
|
994
|
-
function dispatchCallback(f, context, args) {
|
|
995
|
-
|
|
996
|
-
try {
|
|
997
|
-
f.apply(context, args);
|
|
998
|
-
} catch (e) {
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
/**
|
|
1003
|
-
*
|
|
1004
|
-
* @param {SignalHandler[]} handlers
|
|
1005
|
-
* @param {Array} [args]
|
|
1006
|
-
*/
|
|
1007
|
-
function dispatchViaProxy(handlers, args) {
|
|
1008
|
-
const length = handlers.length;
|
|
1009
|
-
|
|
1010
|
-
const stack_pointer = dispatch_stack_top$1;
|
|
1011
|
-
const stack_frame_end = stack_pointer + length;
|
|
1012
|
-
dispatch_stack_top$1 = stack_frame_end;
|
|
1013
|
-
|
|
1014
|
-
let i, h;
|
|
1015
|
-
for (i = 0; i < length; i++) {
|
|
1016
|
-
//copy to proxy
|
|
1017
|
-
dispatch_stack$1[stack_pointer + i] = handlers[length - (i + 1)];
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
for (i = stack_frame_end - 1; i >= stack_pointer; i--) {
|
|
1021
|
-
h = dispatch_stack$1[i];
|
|
1022
|
-
|
|
1023
|
-
if (h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1024
|
-
//handler should be cut
|
|
1025
|
-
const p = handlers.indexOf(h);
|
|
1026
|
-
handlers.splice(p, 1);
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
dispatchCallback(h.handle, h.context, args);
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
//drop stack frame
|
|
1033
|
-
dispatch_stack_top$1 = stack_pointer;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
/**
|
|
1037
|
-
*
|
|
1038
|
-
* @param {SignalHandler[]} handlers
|
|
1039
|
-
* @param {function} f
|
|
1040
|
-
* @param {*} [thisArg]
|
|
1041
|
-
* @returns {number} index of the handler, or -1 if not found
|
|
1042
|
-
*/
|
|
1043
|
-
function findSignalHandlerIndexByHandle(handlers, f, thisArg) {
|
|
1044
|
-
const l = handlers.length;
|
|
1045
|
-
|
|
1046
|
-
for (let i = 0; i < l; i++) {
|
|
1047
|
-
const signalHandler = handlers[i];
|
|
1048
|
-
|
|
1049
|
-
if (signalHandler.handle === f) {
|
|
1050
|
-
|
|
1051
|
-
if (thisArg !== undefined && thisArg !== signalHandler.context) {
|
|
1052
|
-
//context variable doesn't match
|
|
1053
|
-
continue;
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
return i;
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
return -1;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
/**
|
|
1064
|
-
*
|
|
1065
|
-
* @param {SignalHandler[]} handlers
|
|
1066
|
-
* @param {function} f
|
|
1067
|
-
* @param {*} ctx
|
|
1068
|
-
* @returns {number} index of the handler, or -1 if not found
|
|
1069
|
-
*/
|
|
1070
|
-
function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
|
|
1071
|
-
const l = handlers.length;
|
|
1072
|
-
|
|
1073
|
-
for (let i = 0; i < l; i++) {
|
|
1074
|
-
const handler = handlers[i];
|
|
1075
|
-
|
|
1076
|
-
if (handler.handle === f && handler.context === ctx) {
|
|
1077
|
-
return i;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
return -1;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
const SignalFlags = {
|
|
1086
|
-
/**
|
|
1087
|
-
* If set - signal will not invoke handlers when dispatched
|
|
1088
|
-
*/
|
|
1089
|
-
Silent: 1
|
|
1090
|
-
};
|
|
1091
|
-
|
|
1092
|
-
/**
|
|
1093
|
-
* Common dispatch stack
|
|
1094
|
-
* @readonly
|
|
1095
|
-
* @type {SignalHandler[]}
|
|
1096
|
-
*/
|
|
1097
|
-
const dispatch_stack = [];
|
|
1098
|
-
let dispatch_stack_top = 0;
|
|
1099
|
-
|
|
1100
1016
|
/**
|
|
1101
1017
|
* Signal is a type of event bus. You can subscribe to events using {@link add} method and dispatch using sendN method where N is the number of arguments you wish to pass
|
|
1102
|
-
* Signal is different from a normal event bus in that 1 signal corresponds to 1 event type. For example, in HTML you have `addEventListener` which lets you subscribe to any kind of event, let's use "mousedown" as a reference.
|
|
1018
|
+
* Signal is different from a normal event bus in that 1 signal corresponds to 1 event type. For example, in HTML you have `addEventListener` which lets you subscribe to any kind of event, let's use "mousedown" as a reference.
|
|
1019
|
+
* Using a Signal you would instead have a signal corresponding to "mousedown" and dispatch this signal only for this event.
|
|
1103
1020
|
* @example `const mouseDown = new Signal<MouseEvent>(); mouseDown.send1(myMouseEvent);`
|
|
1104
1021
|
*/
|
|
1105
1022
|
class Signal {
|
|
1106
1023
|
/**
|
|
1024
|
+
* Map is used to speed up lookup when removing handlers in case of large number of listeners.
|
|
1107
1025
|
* @private
|
|
1108
|
-
* @type {SignalHandler
|
|
1026
|
+
* @type {Map<function,SignalHandler>}
|
|
1109
1027
|
*/
|
|
1110
|
-
handlers =
|
|
1028
|
+
handlers = new Map();
|
|
1111
1029
|
|
|
1112
1030
|
/**
|
|
1113
1031
|
* Internal flag bitmask
|
|
@@ -1184,9 +1102,15 @@ class Signal {
|
|
|
1184
1102
|
contains(handler, thisArg) {
|
|
1185
1103
|
const handlers = this.handlers;
|
|
1186
1104
|
|
|
1187
|
-
const
|
|
1105
|
+
const sh = handlers.get(handler);
|
|
1188
1106
|
|
|
1189
|
-
|
|
1107
|
+
if (sh === undefined) {
|
|
1108
|
+
return false;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
const existing = signal_handler_list_find(sh, handler, thisArg);
|
|
1112
|
+
|
|
1113
|
+
return existing !== null;
|
|
1190
1114
|
}
|
|
1191
1115
|
|
|
1192
1116
|
mute() {
|
|
@@ -1202,7 +1126,7 @@ class Signal {
|
|
|
1202
1126
|
* @returns {boolean}
|
|
1203
1127
|
*/
|
|
1204
1128
|
hasHandlers() {
|
|
1205
|
-
return this.handlers.
|
|
1129
|
+
return this.handlers.size > 0;
|
|
1206
1130
|
}
|
|
1207
1131
|
|
|
1208
1132
|
/**
|
|
@@ -1216,7 +1140,7 @@ class Signal {
|
|
|
1216
1140
|
|
|
1217
1141
|
handler.setFlag(SignalHandlerFlags.RemoveAfterExecution);
|
|
1218
1142
|
|
|
1219
|
-
this
|
|
1143
|
+
this.#add_handler(handler);
|
|
1220
1144
|
}
|
|
1221
1145
|
|
|
1222
1146
|
/**
|
|
@@ -1226,15 +1150,36 @@ class Signal {
|
|
|
1226
1150
|
*/
|
|
1227
1151
|
add(h, context) {
|
|
1228
1152
|
|
|
1229
|
-
// if (!ENV_PRODUCTION) {
|
|
1230
|
-
// if (this.handlers.length + 1 === 100) {
|
|
1231
|
-
// console.error(`Number of handlers has is 100 now, possible leak detected`);
|
|
1232
|
-
// }
|
|
1233
|
-
// }
|
|
1234
|
-
|
|
1235
1153
|
const handler = new SignalHandler(h, context);
|
|
1236
1154
|
|
|
1237
|
-
this
|
|
1155
|
+
this.#add_handler(handler);
|
|
1156
|
+
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
*
|
|
1161
|
+
* @param {SignalHandler} handler
|
|
1162
|
+
*/
|
|
1163
|
+
#add_handler(handler) {
|
|
1164
|
+
|
|
1165
|
+
const f = handler.handle;
|
|
1166
|
+
const first = this.handlers.get(f);
|
|
1167
|
+
|
|
1168
|
+
if (first === undefined) {
|
|
1169
|
+
this.handlers.set(f, handler);
|
|
1170
|
+
} else {
|
|
1171
|
+
|
|
1172
|
+
handler.next = first;
|
|
1173
|
+
this.handlers.set(f,handler);
|
|
1174
|
+
|
|
1175
|
+
// const last = signal_handler_list_last(first);
|
|
1176
|
+
|
|
1177
|
+
// last.next = handler;
|
|
1178
|
+
|
|
1179
|
+
// assert.ok(signal_handler_list_validate(first, console.error), 'invalid configuration');
|
|
1180
|
+
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1238
1183
|
}
|
|
1239
1184
|
|
|
1240
1185
|
/**
|
|
@@ -1245,11 +1190,44 @@ class Signal {
|
|
|
1245
1190
|
*/
|
|
1246
1191
|
remove(h, thisArg) {
|
|
1247
1192
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
return
|
|
1193
|
+
const first = this.handlers.get(h);
|
|
1194
|
+
|
|
1195
|
+
if (first === undefined) {
|
|
1196
|
+
return false;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
if (first.handle === h && first.context === thisArg) {
|
|
1200
|
+
if (first.next === null) {
|
|
1201
|
+
this.handlers.delete(h);
|
|
1202
|
+
} else {
|
|
1203
|
+
this.handlers.set(h, first.next);
|
|
1204
|
+
// assert.ok(signal_handler_list_validate(first.next, console.error), 'invalid configuration');
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
return true;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
let previous = first;
|
|
1211
|
+
let n = first.next;
|
|
1212
|
+
|
|
1213
|
+
while (n !== null) {
|
|
1214
|
+
|
|
1215
|
+
if (n.handle === h && n.context === thisArg) {
|
|
1216
|
+
|
|
1217
|
+
previous.next = n.next;
|
|
1218
|
+
|
|
1219
|
+
// assert.ok(signal_handler_list_validate(first, console.error), 'invalid configuration');
|
|
1220
|
+
|
|
1221
|
+
return true;
|
|
1222
|
+
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
previous = n;
|
|
1226
|
+
n = n.next;
|
|
1227
|
+
|
|
1252
1228
|
}
|
|
1229
|
+
|
|
1230
|
+
return false;
|
|
1253
1231
|
}
|
|
1254
1232
|
|
|
1255
1233
|
/**
|
|
@@ -1260,8 +1238,58 @@ class Signal {
|
|
|
1260
1238
|
* @deprecated
|
|
1261
1239
|
*/
|
|
1262
1240
|
removeAll() {
|
|
1263
|
-
|
|
1264
|
-
|
|
1241
|
+
this.handlers.clear();
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
*
|
|
1246
|
+
* @param {SignalHandler} handler
|
|
1247
|
+
*/
|
|
1248
|
+
#remove_handler_internal(handler) {
|
|
1249
|
+
|
|
1250
|
+
const first = this.handlers.get(handler.handle);
|
|
1251
|
+
|
|
1252
|
+
if (first === undefined) {
|
|
1253
|
+
// nothing
|
|
1254
|
+
return false;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
// special case for first
|
|
1258
|
+
if (first === handler) {
|
|
1259
|
+
|
|
1260
|
+
if (first.next === null) {
|
|
1261
|
+
// was the only one
|
|
1262
|
+
this.handlers.delete(handler.handle);
|
|
1263
|
+
} else {
|
|
1264
|
+
this.handlers.set(handler.handle, first.next);
|
|
1265
|
+
// assert.ok(signal_handler_list_validate(first.next, console.error), 'invalid configuration');
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
return true;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
let previous = first;
|
|
1272
|
+
let n = first.next;
|
|
1273
|
+
|
|
1274
|
+
while (n !== null) {
|
|
1275
|
+
|
|
1276
|
+
const next = n.next;
|
|
1277
|
+
|
|
1278
|
+
if (n === handler) {
|
|
1279
|
+
previous.next = next;
|
|
1280
|
+
|
|
1281
|
+
// assert.ok(signal_handler_list_validate(first, console.error), 'invalid configuration');
|
|
1282
|
+
|
|
1283
|
+
return true;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
previous = n;
|
|
1287
|
+
n = next;
|
|
1288
|
+
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
// not found
|
|
1292
|
+
return false;
|
|
1265
1293
|
}
|
|
1266
1294
|
|
|
1267
1295
|
/**
|
|
@@ -1274,10 +1302,38 @@ class Signal {
|
|
|
1274
1302
|
return;
|
|
1275
1303
|
}
|
|
1276
1304
|
|
|
1277
|
-
|
|
1305
|
+
const handlers = this.handlers;
|
|
1306
|
+
|
|
1307
|
+
for (const handle of handlers.values()) {
|
|
1308
|
+
|
|
1309
|
+
let _h = handle;
|
|
1310
|
+
|
|
1311
|
+
do {
|
|
1312
|
+
|
|
1313
|
+
const next = _h.next;
|
|
1314
|
+
|
|
1315
|
+
if (_h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1316
|
+
//handler should be cut
|
|
1317
|
+
this.#remove_handler_internal(_h);
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
const _f = _h.handle;
|
|
1321
|
+
|
|
1322
|
+
try {
|
|
1323
|
+
_f.apply(_h.context, args);
|
|
1324
|
+
} catch (e) {
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
_h = next;
|
|
1328
|
+
|
|
1329
|
+
} while (_h !== null);
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
}
|
|
1278
1333
|
|
|
1279
1334
|
}
|
|
1280
1335
|
|
|
1336
|
+
|
|
1281
1337
|
/**
|
|
1282
1338
|
* dispatch without a value.
|
|
1283
1339
|
* Allows JS engine to optimize for monomorphic call sites
|
|
@@ -1290,41 +1346,33 @@ class Signal {
|
|
|
1290
1346
|
|
|
1291
1347
|
const handlers = this.handlers;
|
|
1292
1348
|
|
|
1293
|
-
const
|
|
1349
|
+
for (const handle of handlers.values()) {
|
|
1294
1350
|
|
|
1295
|
-
|
|
1296
|
-
const stack_frame_end = stack_pointer + length;
|
|
1297
|
-
dispatch_stack_top = stack_frame_end;
|
|
1351
|
+
let _h = handle;
|
|
1298
1352
|
|
|
1299
|
-
|
|
1353
|
+
do {
|
|
1300
1354
|
|
|
1301
|
-
|
|
1302
|
-
for (i = 0; i < length; i++) {
|
|
1303
|
-
//copy to proxy
|
|
1304
|
-
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
1305
|
-
}
|
|
1355
|
+
const next = _h.next;
|
|
1306
1356
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1357
|
+
if (_h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1358
|
+
//handler should be cut
|
|
1359
|
+
this.#remove_handler_internal(_h);
|
|
1360
|
+
}
|
|
1310
1361
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1362
|
+
const _f = _h.handle;
|
|
1363
|
+
|
|
1364
|
+
try {
|
|
1365
|
+
_f.call(_h.context);
|
|
1366
|
+
} catch (e) {
|
|
1367
|
+
}
|
|
1316
1368
|
|
|
1317
|
-
|
|
1369
|
+
_h = next;
|
|
1370
|
+
|
|
1371
|
+
} while (_h !== null);
|
|
1318
1372
|
|
|
1319
|
-
try {
|
|
1320
|
-
f.call(h.context);
|
|
1321
|
-
} catch (e) {
|
|
1322
|
-
}
|
|
1323
1373
|
|
|
1324
1374
|
}
|
|
1325
1375
|
|
|
1326
|
-
//drop stack frame
|
|
1327
|
-
dispatch_stack_top = stack_pointer;
|
|
1328
1376
|
}
|
|
1329
1377
|
|
|
1330
1378
|
/**
|
|
@@ -1340,42 +1388,33 @@ class Signal {
|
|
|
1340
1388
|
|
|
1341
1389
|
const handlers = this.handlers;
|
|
1342
1390
|
|
|
1343
|
-
const
|
|
1391
|
+
for (const handle of handlers.values()) {
|
|
1344
1392
|
|
|
1345
|
-
|
|
1346
|
-
const stack_frame_end = stack_pointer + length;
|
|
1347
|
-
dispatch_stack_top = stack_frame_end;
|
|
1393
|
+
let _h = handle;
|
|
1348
1394
|
|
|
1395
|
+
do {
|
|
1349
1396
|
|
|
1350
|
-
|
|
1397
|
+
const next = _h.next;
|
|
1351
1398
|
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
}
|
|
1399
|
+
if (_h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1400
|
+
//handler should be cut
|
|
1401
|
+
this.#remove_handler_internal(_h);
|
|
1402
|
+
}
|
|
1357
1403
|
|
|
1358
|
-
|
|
1359
|
-
for (i = stack_frame_end - 1; i >= stack_pointer; i--) {
|
|
1360
|
-
h = dispatch_stack[i];
|
|
1404
|
+
const _f = _h.handle;
|
|
1361
1405
|
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
}
|
|
1406
|
+
try {
|
|
1407
|
+
_f.call(_h.context, arg);
|
|
1408
|
+
} catch (e) {
|
|
1409
|
+
}
|
|
1367
1410
|
|
|
1368
|
-
|
|
1411
|
+
_h = next;
|
|
1412
|
+
|
|
1413
|
+
} while (_h !== null);
|
|
1369
1414
|
|
|
1370
|
-
try {
|
|
1371
|
-
f.call(h.context, arg);
|
|
1372
|
-
} catch (e) {
|
|
1373
|
-
}
|
|
1374
1415
|
|
|
1375
1416
|
}
|
|
1376
1417
|
|
|
1377
|
-
//drop stack frame
|
|
1378
|
-
dispatch_stack_top = stack_pointer;
|
|
1379
1418
|
}
|
|
1380
1419
|
|
|
1381
1420
|
/**
|
|
@@ -1391,41 +1430,32 @@ class Signal {
|
|
|
1391
1430
|
|
|
1392
1431
|
const handlers = this.handlers;
|
|
1393
1432
|
|
|
1394
|
-
const
|
|
1433
|
+
for (const handle of handlers.values()) {
|
|
1395
1434
|
|
|
1396
|
-
|
|
1397
|
-
const stack_frame_end = stack_pointer + length;
|
|
1398
|
-
dispatch_stack_top = stack_frame_end;
|
|
1435
|
+
let _h = handle;
|
|
1399
1436
|
|
|
1400
|
-
|
|
1437
|
+
do {
|
|
1401
1438
|
|
|
1402
|
-
|
|
1403
|
-
for (i = 0; i < length; i++) {
|
|
1404
|
-
//copy to proxy
|
|
1405
|
-
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
1406
|
-
}
|
|
1439
|
+
const next = _h.next;
|
|
1407
1440
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1441
|
+
if (_h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1442
|
+
//handler should be cut
|
|
1443
|
+
this.#remove_handler_internal(_h);
|
|
1444
|
+
}
|
|
1411
1445
|
|
|
1412
|
-
|
|
1413
|
-
//handler should be cut
|
|
1414
|
-
const p = handlers.indexOf(h);
|
|
1415
|
-
handlers.splice(p, 1);
|
|
1416
|
-
}
|
|
1446
|
+
const _f = _h.handle;
|
|
1417
1447
|
|
|
1418
|
-
|
|
1448
|
+
try {
|
|
1449
|
+
_f.call(_h.context, a, b);
|
|
1450
|
+
} catch (e) {
|
|
1451
|
+
}
|
|
1419
1452
|
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1453
|
+
_h = next;
|
|
1454
|
+
|
|
1455
|
+
} while (_h !== null);
|
|
1424
1456
|
|
|
1425
|
-
}
|
|
1426
1457
|
|
|
1427
|
-
|
|
1428
|
-
dispatch_stack_top = stack_pointer;
|
|
1458
|
+
}
|
|
1429
1459
|
}
|
|
1430
1460
|
|
|
1431
1461
|
/**
|
|
@@ -1440,43 +1470,35 @@ class Signal {
|
|
|
1440
1470
|
return;
|
|
1441
1471
|
}
|
|
1442
1472
|
|
|
1473
|
+
|
|
1443
1474
|
const handlers = this.handlers;
|
|
1444
1475
|
|
|
1445
|
-
const
|
|
1476
|
+
for (const handle of handlers.values()) {
|
|
1446
1477
|
|
|
1447
|
-
|
|
1448
|
-
const stack_frame_end = stack_pointer + length;
|
|
1449
|
-
dispatch_stack_top = stack_frame_end;
|
|
1478
|
+
let _h = handle;
|
|
1450
1479
|
|
|
1451
|
-
|
|
1480
|
+
do {
|
|
1452
1481
|
|
|
1453
|
-
|
|
1454
|
-
for (i = 0; i < length; i++) {
|
|
1455
|
-
//copy to proxy
|
|
1456
|
-
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
1457
|
-
}
|
|
1482
|
+
const next = _h.next;
|
|
1458
1483
|
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1484
|
+
if (_h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1485
|
+
//handler should be cut
|
|
1486
|
+
this.#remove_handler_internal(_h);
|
|
1487
|
+
}
|
|
1462
1488
|
|
|
1463
|
-
|
|
1464
|
-
//handler should be cut
|
|
1465
|
-
const p = handlers.indexOf(h);
|
|
1466
|
-
handlers.splice(p, 1);
|
|
1467
|
-
}
|
|
1489
|
+
const _f = _h.handle;
|
|
1468
1490
|
|
|
1469
|
-
|
|
1491
|
+
try {
|
|
1492
|
+
_f.call(_h.context, a, b, c);
|
|
1493
|
+
} catch (e) {
|
|
1494
|
+
}
|
|
1470
1495
|
|
|
1471
|
-
|
|
1472
|
-
f.call(h.context, a, b, c);
|
|
1473
|
-
} catch (e) {
|
|
1474
|
-
}
|
|
1496
|
+
_h = next;
|
|
1475
1497
|
|
|
1476
|
-
|
|
1498
|
+
} while (_h !== null);
|
|
1477
1499
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1500
|
+
|
|
1501
|
+
}
|
|
1480
1502
|
}
|
|
1481
1503
|
|
|
1482
1504
|
/**
|
|
@@ -1492,43 +1514,35 @@ class Signal {
|
|
|
1492
1514
|
return;
|
|
1493
1515
|
}
|
|
1494
1516
|
|
|
1517
|
+
|
|
1495
1518
|
const handlers = this.handlers;
|
|
1496
1519
|
|
|
1497
|
-
const
|
|
1520
|
+
for (const handle of handlers.values()) {
|
|
1498
1521
|
|
|
1499
|
-
|
|
1500
|
-
const stack_frame_end = stack_pointer + length;
|
|
1501
|
-
dispatch_stack_top = stack_frame_end;
|
|
1522
|
+
let _h = handle;
|
|
1502
1523
|
|
|
1503
|
-
|
|
1524
|
+
do {
|
|
1504
1525
|
|
|
1505
|
-
|
|
1506
|
-
for (i = 0; i < length; i++) {
|
|
1507
|
-
//copy to proxy
|
|
1508
|
-
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
1509
|
-
}
|
|
1526
|
+
const next = _h.next;
|
|
1510
1527
|
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1528
|
+
if (_h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1529
|
+
//handler should be cut
|
|
1530
|
+
this.#remove_handler_internal(_h);
|
|
1531
|
+
}
|
|
1514
1532
|
|
|
1515
|
-
|
|
1516
|
-
//handler should be cut
|
|
1517
|
-
const p = handlers.indexOf(h);
|
|
1518
|
-
handlers.splice(p, 1);
|
|
1519
|
-
}
|
|
1533
|
+
const _f = _h.handle;
|
|
1520
1534
|
|
|
1521
|
-
|
|
1535
|
+
try {
|
|
1536
|
+
_f.call(_h.context, a, b, c, d);
|
|
1537
|
+
} catch (e) {
|
|
1538
|
+
}
|
|
1522
1539
|
|
|
1523
|
-
|
|
1524
|
-
f.call(h.context, a, b, c, d);
|
|
1525
|
-
} catch (e) {
|
|
1526
|
-
}
|
|
1540
|
+
_h = next;
|
|
1527
1541
|
|
|
1528
|
-
|
|
1542
|
+
} while (_h !== null);
|
|
1529
1543
|
|
|
1530
|
-
|
|
1531
|
-
|
|
1544
|
+
|
|
1545
|
+
}
|
|
1532
1546
|
}
|
|
1533
1547
|
|
|
1534
1548
|
/**
|
|
@@ -1546,43 +1560,35 @@ class Signal {
|
|
|
1546
1560
|
return;
|
|
1547
1561
|
}
|
|
1548
1562
|
|
|
1563
|
+
|
|
1549
1564
|
const handlers = this.handlers;
|
|
1550
1565
|
|
|
1551
|
-
const
|
|
1566
|
+
for (const handle of handlers.values()) {
|
|
1552
1567
|
|
|
1553
|
-
|
|
1554
|
-
const stack_frame_end = stack_pointer + length;
|
|
1555
|
-
dispatch_stack_top = stack_frame_end;
|
|
1568
|
+
let _h = handle;
|
|
1556
1569
|
|
|
1557
|
-
|
|
1570
|
+
do {
|
|
1558
1571
|
|
|
1559
|
-
|
|
1560
|
-
for (i = 0; i < length; i++) {
|
|
1561
|
-
//copy to proxy
|
|
1562
|
-
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
1563
|
-
}
|
|
1572
|
+
const next = _h.next;
|
|
1564
1573
|
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1574
|
+
if (_h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1575
|
+
//handler should be cut
|
|
1576
|
+
this.#remove_handler_internal(_h);
|
|
1577
|
+
}
|
|
1568
1578
|
|
|
1569
|
-
|
|
1570
|
-
//handler should be cut
|
|
1571
|
-
const p = handlers.indexOf(h);
|
|
1572
|
-
handlers.splice(p, 1);
|
|
1573
|
-
}
|
|
1579
|
+
const _f = _h.handle;
|
|
1574
1580
|
|
|
1575
|
-
|
|
1581
|
+
try {
|
|
1582
|
+
_f.call(_h.context, a, b, c, d, e, f);
|
|
1583
|
+
} catch (e) {
|
|
1584
|
+
}
|
|
1576
1585
|
|
|
1577
|
-
|
|
1578
|
-
handle.call(h.context, a, b, c, d, e, f);
|
|
1579
|
-
} catch (e) {
|
|
1580
|
-
}
|
|
1586
|
+
_h = next;
|
|
1581
1587
|
|
|
1582
|
-
|
|
1588
|
+
} while (_h !== null);
|
|
1583
1589
|
|
|
1584
|
-
|
|
1585
|
-
|
|
1590
|
+
|
|
1591
|
+
}
|
|
1586
1592
|
}
|
|
1587
1593
|
|
|
1588
1594
|
/**
|
|
@@ -1604,41 +1610,32 @@ class Signal {
|
|
|
1604
1610
|
|
|
1605
1611
|
const handlers = this.handlers;
|
|
1606
1612
|
|
|
1607
|
-
const
|
|
1613
|
+
for (const handle of handlers.values()) {
|
|
1608
1614
|
|
|
1609
|
-
|
|
1610
|
-
const stack_frame_end = stack_pointer + length;
|
|
1611
|
-
dispatch_stack_top = stack_frame_end;
|
|
1615
|
+
let _h = handle;
|
|
1612
1616
|
|
|
1613
|
-
|
|
1617
|
+
do {
|
|
1614
1618
|
|
|
1615
|
-
|
|
1616
|
-
for (i = 0; i < length; i++) {
|
|
1617
|
-
//copy to proxy
|
|
1618
|
-
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
1619
|
-
}
|
|
1619
|
+
const next = _h.next;
|
|
1620
1620
|
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1621
|
+
if (_h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1622
|
+
//handler should be cut
|
|
1623
|
+
this.#remove_handler_internal(_h);
|
|
1624
|
+
}
|
|
1624
1625
|
|
|
1625
|
-
|
|
1626
|
-
//handler should be cut
|
|
1627
|
-
const p = handlers.indexOf(handler);
|
|
1628
|
-
handlers.splice(p, 1);
|
|
1629
|
-
}
|
|
1626
|
+
const _f = _h.handle;
|
|
1630
1627
|
|
|
1631
|
-
|
|
1628
|
+
try {
|
|
1629
|
+
_f.call(_h.context, a, b, c, d, e, f, g, h);
|
|
1630
|
+
} catch (e) {
|
|
1631
|
+
}
|
|
1632
1632
|
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1633
|
+
_h = next;
|
|
1634
|
+
|
|
1635
|
+
} while (_h !== null);
|
|
1637
1636
|
|
|
1638
|
-
}
|
|
1639
1637
|
|
|
1640
|
-
|
|
1641
|
-
dispatch_stack_top = stack_pointer;
|
|
1638
|
+
}
|
|
1642
1639
|
}
|
|
1643
1640
|
|
|
1644
1641
|
/**
|
|
@@ -1665,44 +1662,7 @@ class Signal {
|
|
|
1665
1662
|
* @readonly
|
|
1666
1663
|
* @type {boolean}
|
|
1667
1664
|
*/
|
|
1668
|
-
Signal.prototype.isSignal = true;
|
|
1669
|
-
|
|
1670
|
-
/**
|
|
1671
|
-
*
|
|
1672
|
-
* @param {Signal} signal
|
|
1673
|
-
* @param {function} h
|
|
1674
|
-
* @returns {boolean}
|
|
1675
|
-
*/
|
|
1676
|
-
function removeHandlerByHandler(signal, h) {
|
|
1677
|
-
const handlers = signal.handlers;
|
|
1678
|
-
let i = findSignalHandlerIndexByHandle(handlers, h);
|
|
1679
|
-
|
|
1680
|
-
if (i >= 0) {
|
|
1681
|
-
handlers.splice(i, 1);
|
|
1682
|
-
return true;
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
return false;
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
/**
|
|
1689
|
-
*
|
|
1690
|
-
* @param {Signal} signal
|
|
1691
|
-
* @param {function} h
|
|
1692
|
-
* @param {*} ctx
|
|
1693
|
-
* @returns {boolean}
|
|
1694
|
-
*/
|
|
1695
|
-
function removeHandlerByHandlerAndContext(signal, h, ctx) {
|
|
1696
|
-
const handlers = signal.handlers;
|
|
1697
|
-
const i = findSignalHandlerIndexByHandleAndContext(handlers, h, ctx);
|
|
1698
|
-
|
|
1699
|
-
if (i >= 0) {
|
|
1700
|
-
handlers.splice(i, 1);
|
|
1701
|
-
return true;
|
|
1702
|
-
}
|
|
1703
|
-
|
|
1704
|
-
return false;
|
|
1705
|
-
}
|
|
1665
|
+
Signal.prototype.isSignal = true;
|
|
1706
1666
|
|
|
1707
1667
|
/**
|
|
1708
1668
|
* Constrain a value to lie between specified min/max values
|
|
@@ -69810,7 +69770,6 @@ function frustum_from_camera(camera, result, update_projection = true) {
|
|
|
69810
69770
|
result.setFromProjectionMatrix(matrix4);
|
|
69811
69771
|
}
|
|
69812
69772
|
|
|
69813
|
-
const m4_scratch = new Matrix4();
|
|
69814
69773
|
const v3_scratch_0 = new Vector3$1();
|
|
69815
69774
|
const v3_scratch_1 = new Vector3$1();
|
|
69816
69775
|
|
|
@@ -69819,7 +69778,7 @@ const v3_scratch_1 = new Vector3$1();
|
|
|
69819
69778
|
* @param {Quaternion} output
|
|
69820
69779
|
* @param {Quaternion} input
|
|
69821
69780
|
*/
|
|
69822
|
-
function
|
|
69781
|
+
function quaternion_invert_orientation(output, input) {
|
|
69823
69782
|
const forward = v3_scratch_0;
|
|
69824
69783
|
const up = v3_scratch_1;
|
|
69825
69784
|
|
|
@@ -69829,9 +69788,12 @@ function invertQuaternionOrientation(output, input) {
|
|
|
69829
69788
|
forward.applyQuaternion(input);
|
|
69830
69789
|
up.applyQuaternion(input);
|
|
69831
69790
|
|
|
69832
|
-
|
|
69791
|
+
// point in the opposite direction
|
|
69792
|
+
forward.negate();
|
|
69833
69793
|
|
|
69834
|
-
output.
|
|
69794
|
+
output.lookRotation(
|
|
69795
|
+
forward, up
|
|
69796
|
+
);
|
|
69835
69797
|
}
|
|
69836
69798
|
|
|
69837
69799
|
//
|
|
@@ -69907,7 +69869,7 @@ class Camera {
|
|
|
69907
69869
|
* @param {Quaternion} input
|
|
69908
69870
|
*/
|
|
69909
69871
|
getReciprocalRotation(output, input) {
|
|
69910
|
-
|
|
69872
|
+
quaternion_invert_orientation(output, input);
|
|
69911
69873
|
}
|
|
69912
69874
|
|
|
69913
69875
|
get clip_far() {
|
|
@@ -70186,6 +70148,8 @@ function update_camera_transform(camera) {
|
|
|
70186
70148
|
threeUpdateTransform(three_camera);
|
|
70187
70149
|
}
|
|
70188
70150
|
|
|
70151
|
+
const scratch_quat = new Quaternion$1();
|
|
70152
|
+
|
|
70189
70153
|
/**
|
|
70190
70154
|
*
|
|
70191
70155
|
* @param {THREE.Camera} object
|
|
@@ -70198,7 +70162,11 @@ function three_camera_set_transform_rotation(object, rotation) {
|
|
|
70198
70162
|
See: https://github.com/mrdoob/three.js/blob/412b99a7f26e117ea97f40eb53d010ab81aa3279/src/core/Object3D.js#L282
|
|
70199
70163
|
*/
|
|
70200
70164
|
|
|
70201
|
-
|
|
70165
|
+
quaternion_invert_orientation(scratch_quat, rotation);
|
|
70166
|
+
|
|
70167
|
+
object.quaternion.set(
|
|
70168
|
+
scratch_quat.x, scratch_quat.y, scratch_quat.z, scratch_quat.w
|
|
70169
|
+
);
|
|
70202
70170
|
|
|
70203
70171
|
object.rotation.setFromQuaternion(object.quaternion);
|
|
70204
70172
|
|
|
@@ -93739,6 +93707,55 @@ function promiseTask(promise, name) {
|
|
|
93739
93707
|
});
|
|
93740
93708
|
}
|
|
93741
93709
|
|
|
93710
|
+
/**
|
|
93711
|
+
*
|
|
93712
|
+
* @param {SignalHandler[]} handlers
|
|
93713
|
+
* @param {function} f
|
|
93714
|
+
* @param {*} [thisArg]
|
|
93715
|
+
* @returns {number} index of the handler, or -1 if not found
|
|
93716
|
+
*/
|
|
93717
|
+
function findSignalHandlerIndexByHandle(handlers, f, thisArg) {
|
|
93718
|
+
const l = handlers.length;
|
|
93719
|
+
|
|
93720
|
+
for (let i = 0; i < l; i++) {
|
|
93721
|
+
const signalHandler = handlers[i];
|
|
93722
|
+
|
|
93723
|
+
if (signalHandler.handle === f) {
|
|
93724
|
+
|
|
93725
|
+
if (thisArg !== undefined && thisArg !== signalHandler.context) {
|
|
93726
|
+
//context variable doesn't match
|
|
93727
|
+
continue;
|
|
93728
|
+
}
|
|
93729
|
+
|
|
93730
|
+
return i;
|
|
93731
|
+
}
|
|
93732
|
+
}
|
|
93733
|
+
|
|
93734
|
+
return -1;
|
|
93735
|
+
}
|
|
93736
|
+
|
|
93737
|
+
/**
|
|
93738
|
+
*
|
|
93739
|
+
* @param {SignalHandler[]} handlers
|
|
93740
|
+
* @param {function} f
|
|
93741
|
+
* @param {*} ctx
|
|
93742
|
+
* @returns {number} index of the handler, or -1 if not found
|
|
93743
|
+
*/
|
|
93744
|
+
function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
|
|
93745
|
+
const l = handlers.length;
|
|
93746
|
+
|
|
93747
|
+
for (let i = 0; i < l; i++) {
|
|
93748
|
+
const handler = handlers[i];
|
|
93749
|
+
|
|
93750
|
+
if (handler.handle === f && handler.context === ctx) {
|
|
93751
|
+
return i;
|
|
93752
|
+
}
|
|
93753
|
+
|
|
93754
|
+
}
|
|
93755
|
+
|
|
93756
|
+
return -1;
|
|
93757
|
+
}
|
|
93758
|
+
|
|
93742
93759
|
/**
|
|
93743
93760
|
* Matches a supplies component mask against a larger set
|
|
93744
93761
|
* @param {BitSet} componentOccupancy
|
|
@@ -96843,6 +96860,62 @@ class SoundEngine {
|
|
|
96843
96860
|
}
|
|
96844
96861
|
}
|
|
96845
96862
|
|
|
96863
|
+
/**
|
|
96864
|
+
* Common dispatch stack
|
|
96865
|
+
* @readonly
|
|
96866
|
+
* @type {SignalHandler[]}
|
|
96867
|
+
*/
|
|
96868
|
+
const dispatch_stack = [];
|
|
96869
|
+
let dispatch_stack_top = 0;
|
|
96870
|
+
|
|
96871
|
+
/**
|
|
96872
|
+
*
|
|
96873
|
+
* @param {function} f
|
|
96874
|
+
* @param {*} context
|
|
96875
|
+
* @param {Array} args
|
|
96876
|
+
*/
|
|
96877
|
+
function dispatchCallback(f, context, args) {
|
|
96878
|
+
|
|
96879
|
+
try {
|
|
96880
|
+
f.apply(context, args);
|
|
96881
|
+
} catch (e) {
|
|
96882
|
+
}
|
|
96883
|
+
}
|
|
96884
|
+
|
|
96885
|
+
/**
|
|
96886
|
+
*
|
|
96887
|
+
* @param {SignalHandler[]} handlers
|
|
96888
|
+
* @param {Array} [args]
|
|
96889
|
+
*/
|
|
96890
|
+
function dispatchViaProxy(handlers, args) {
|
|
96891
|
+
const length = handlers.length;
|
|
96892
|
+
|
|
96893
|
+
const stack_pointer = dispatch_stack_top;
|
|
96894
|
+
const stack_frame_end = stack_pointer + length;
|
|
96895
|
+
dispatch_stack_top = stack_frame_end;
|
|
96896
|
+
|
|
96897
|
+
let i, h;
|
|
96898
|
+
for (i = 0; i < length; i++) {
|
|
96899
|
+
//copy to proxy
|
|
96900
|
+
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
96901
|
+
}
|
|
96902
|
+
|
|
96903
|
+
for (i = stack_frame_end - 1; i >= stack_pointer; i--) {
|
|
96904
|
+
h = dispatch_stack[i];
|
|
96905
|
+
|
|
96906
|
+
if (h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
96907
|
+
//handler should be cut
|
|
96908
|
+
const p = handlers.indexOf(h);
|
|
96909
|
+
handlers.splice(p, 1);
|
|
96910
|
+
}
|
|
96911
|
+
|
|
96912
|
+
dispatchCallback(h.handle, h.context, args);
|
|
96913
|
+
}
|
|
96914
|
+
|
|
96915
|
+
//drop stack frame
|
|
96916
|
+
dispatch_stack_top = stack_pointer;
|
|
96917
|
+
}
|
|
96918
|
+
|
|
96846
96919
|
class SimpleStateMachineDescription {
|
|
96847
96920
|
constructor() {
|
|
96848
96921
|
this.__states = new BitSet();
|