@lwc/engine-core 3.0.0 → 3.0.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/dist/index.js CHANGED
@@ -251,10 +251,18 @@ class ReactiveObserver {
251
251
  const { listeners } = this;
252
252
  const len = listeners.length;
253
253
  if (len > 0) {
254
- for (let i = 0; i < len; i += 1) {
254
+ for (let i = 0; i < len; i++) {
255
255
  const set = listeners[i];
256
- const pos = ArrayIndexOf.call(listeners[i], this);
257
- ArraySplice.call(set, pos, 1);
256
+ if (set.length === 1) {
257
+ // Perf optimization for the common case - the length is usually 1, so avoid the indexOf+splice.
258
+ // If the length is 1, we can also be sure that `this` is the first item in the array.
259
+ set.length = 0;
260
+ }
261
+ else {
262
+ // Slow case
263
+ const pos = ArrayIndexOf.call(set, this);
264
+ ArraySplice.call(set, pos, 1);
265
+ }
258
266
  }
259
267
  listeners.length = 0;
260
268
  }
@@ -6895,5 +6903,5 @@ function readonly(obj) {
6895
6903
  }
6896
6904
 
6897
6905
  export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6898
- /** version: 3.0.0 */
6906
+ /** version: 3.0.1 */
6899
6907
  //# sourceMappingURL=index.js.map