@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/dist/data-binding.js +17 -17
- package/dist/data-binding.js.map +2 -2
- package/dist/main.js +20 -20
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +20 -20
- package/dist/main.lite.js.map +2 -2
- package/package.json +1 -1
- package/src/data-binding/index.js +7 -6
package/package.json
CHANGED
|
@@ -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
|