}, getOpts() { return this.opts; }, setOpts(opts, update) { this.opts = opts; if (!update) this.update(); return this; } }; // mixin object tag.mixin(optsMixin); // register shared mixin riot.mixin('optsMixin', optsMixin); // use shared mixin tag.mixin('optsMixin'); // register global mixin and add it to all tag instances riot.mixin(optsMixin); // using mixin in tag instances interface TagWithOptsMixin extends riot.TagInterface, OptsMixin { } (tag as TagWithOptsMixin).setOpts(mockOpts, true).getOpts(); interface TimerTag extends riot.TagInterface { opts: { start: number; };
import '../src/polyfills'; import * as riot from 'riot'; window['riot'] = riot; riot.mixin({ init() { this.mixin('test'); } });