@@ -291,42 +291,40 @@ export default function dom ( parsed, source, options, names ) {
291
291
292
292
this._handlers = Object.create( null );
293
293
294
- this.get = get;
295
- this.fire = fire;
296
- this.observe = observe;
297
- this.on = on;
298
- this.set = set;
299
- this.teardown = teardown;
300
-
301
294
this._root = options._root;
302
295
this._yield = options._yield;
303
296
304
297
${ builders . init }
305
298
}
299
+ ` ) ;
300
+
301
+ if ( templateProperties . methods ) {
302
+ builders . main . addBlock ( `${ name } .prototype = template.methods;` ) ;
303
+ }
304
+
305
+ builders . main . addBlock ( deindent `
306
+ ${ name } .prototype.get = ${ shared . get } ;
307
+
308
+ ${ name } .prototype.fire = ${ shared . fire } ;
306
309
307
- function set ( newState ) {
310
+ ${ name } .prototype.observe = ${ shared . observe } ;
311
+
312
+ ${ name } .prototype.on = ${ shared . on } ;
313
+
314
+ ${ name } .prototype.set = function set ( newState ) {
308
315
${ builders . set }
309
- }
316
+ };
310
317
311
- function teardown ( detach ) {
318
+ ${ name } .prototype.teardown = function teardown ( detach ) {
312
319
this.fire( 'teardown' );${ templateProperties . onteardown ? `\ntemplate.onteardown.call( this );` : `` }
313
320
314
321
this._fragment.teardown( detach !== false );
315
322
this._fragment = null;
316
323
317
324
this._state = {};
318
- }
325
+ };
319
326
` ) ;
320
327
321
- if ( templateProperties . methods ) {
322
- builders . main . addBlock ( `${ name } .prototype = template.methods;` ) ;
323
- }
324
-
325
- builders . main . addBlock ( shared . fire . toString ( ) ) ;
326
- builders . main . addBlock ( shared . get . toString ( ) ) ;
327
- builders . main . addBlock ( shared . observe . toString ( ) ) ;
328
- builders . main . addBlock ( shared . on . toString ( ) ) ;
329
-
330
328
builders . main . addBlock ( shared . dispatchObservers . toString ( ) ) ;
331
329
332
330
Object . keys ( generator . uses ) . forEach ( key => {
0 commit comments