@woosh/meep-engine 2.98.2 → 2.98.3

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 CHANGED
@@ -1147,8 +1147,9 @@ class Signal {
1147
1147
 
1148
1148
  /**
1149
1149
  * Remove all handlers.
1150
- * Please note that this will remove even all handlers, irrespective of where they were added from.
1150
+ * Please note that this will remove even all handlers, irrespective of where they were added from. If another script is attaching to the same signal, using this method will potentially break that code.
1151
1151
  * For most use cases, prefer to use {@link remove} method instead, or make use of {@link SignalBinding} if you need to keep track of multiple handlers
1152
+ * NOTE: Consider this method to be unsafe, only use it when you understand the implications
1152
1153
  */
1153
1154
  removeAll() {
1154
1155
  const handlers = this.handlers;
@@ -68240,6 +68241,23 @@ class SignalBinding {
68240
68241
  this.#linked = false;
68241
68242
  this.signal.remove(this.handler, this.context);
68242
68243
  }
68244
+
68245
+ /**
68246
+ * Creates a {@link SignalBinding} and links it immediately. Utility method
68247
+ * @param {Signal} signal
68248
+ * @param {function} handler
68249
+ * @param {*} [context]
68250
+ * @return {SignalBinding}
68251
+ */
68252
+ static bind(
68253
+ signal, handler, context
68254
+ ) {
68255
+ const r = new SignalBinding(signal, handler, context);
68256
+
68257
+ r.link();
68258
+
68259
+ return r;
68260
+ }
68243
68261
  }
68244
68262
 
68245
68263
  /**