@webqit/oohtml 4.2.0 → 4.3.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/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "wicg-proposal"
15
15
  ],
16
16
  "homepage": "https://webqit.io/tooling/oohtml",
17
- "version": "4.2.0",
17
+ "version": "4.3.1",
18
18
  "license": "MIT",
19
19
  "repository": {
20
20
  "type": "git",
@@ -54,8 +54,7 @@ function createDynamicScope( config, root ) {
54
54
  const scope = Object.create( null ), abortController = new AbortController;
55
55
  scope[ '$exec__' ] = ( target, prop, ...args ) => {
56
56
  const exec = () => {
57
- target[ prop ]( ...args );
58
- try { } catch( e ) { console.error( `${ e.message } at ${ e.cause }` ); }
57
+ try { target[ prop ]( ...args ); } catch( e ) { console.error( `Error executing "${ prop }": ${ e.message } at ${ e.cause }` ); }
59
58
  };
60
59
  realdom.schedule( 'write', exec );
61
60
  };
@@ -173,6 +172,7 @@ const inlineParseCache = new Map;
173
172
  function compileInlineBindings( config, str ) {
174
173
  if ( inlineParseCache.has( str ) ) return inlineParseCache.get( str );
175
174
  const validation = {};
175
+ let $event_i = -1;
176
176
  const source = _splitOuter( str, ';' ).map( str => {
177
177
  const [ left, right ] = _splitOuter( str, ':' ).map( x => x.trim() );
178
178
  const directive = left[ 0 ], param = left.slice( 1 ).trim();
@@ -242,11 +242,12 @@ function compileInlineBindings( config, str ) {
242
242
  }
243
243
  // Events
244
244
  if ( directive === '@' ) {
245
+ $event_i++;
245
246
  return `
246
- const handler = event => ${ right.startsWith('{') ? right : arg };
247
- this.addEventListener( '${ param }', handler );
248
- const abort = () => this.removeEventListener( '${ param }', handler );
249
- this.$oohtml_internal_databinding_signals?.push( { abort } );
247
+ const handler${ $event_i } = event => ${ right.startsWith('{') ? right : arg };
248
+ this.addEventListener( '${ param }', handler${ $event_i } );
249
+ const abort${ $event_i } = () => this.removeEventListener( '${ param }', handler${ $event_i } );
250
+ this.$oohtml_internal_databinding_signals?.push( { abort: abort${ $event_i } } );
250
251
  `;
251
252
  }
252
253
  // Functions