Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var plastiq = require('plastiq');
- var h = plastiq.html;
- var pogo = require('pogo');
- var code = "h 'h1' 'Edit me'";
- function render(model) {
- return h('div',
- h('textarea', {
- style: textAreaStyle,
- binding: [model, 'code'],
- attributes: { autofocus: true }
- }),
- h('#print', evalPogo(model.code))
- );
- }
- function evalPogo(code) {
- try {
- return eval(pogo.compile(code, { inScope: false }));
- } catch (e) {
- return h("pre.error", "ERROR: ", e.toString());
- }
- }
- var textAreaStyle = {
- width: '80%',
- height: '200px',
- padding: '5px',
- fontFamily: "'Source Code Pro', Monaco, Consolas, monospace",
- fontSize: '15px'
- };
- plastiq.attach(document.body, render, { code: code });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement