Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 24x 53x 53x 67x 53x 24x | // tslint:disable:no-eval
import TagMap from './TagMap';
import TagArgs from './TagArgs';
import { tag } from 'riot';
import each from 'lodash/each';
/**
* Unifiyed `this` object during riot.compile().
*
* Note top level script in a tag is executed on compilation.
*/
export default class EvalContext {
evalTag(tagjs: string) {
// @TODO: use Module in serverside.
const [tags, tagNames] = eval(
`var t={},s=[],riot={tag2:function(n){t[n]=arguments;s.push(n);return n}};${tagjs};[t,s];`
);
each(tags, (x: TagArgs) => tag.apply(this, x));
return {
tags: tags as TagMap,
tagNames: tagNames as string[],
};
}
}
|