Skip to content

Instantly share code, notes, and snippets.

@piuccio piuccio/console.js
Last active Dec 12, 2015

Embed
What would you like to do?
hashspace Plain text template with binding modifiers
// In this console you can interact with the model
// without causing a recompilation of the template
//
// The model is accessible with the name `vscope`
// You can display it calling `log()`
// You can interact with it using the `json` helper
// To refresh a template, call `refresh()`
//
// Try for instance the following code
// Hint: Press Ctrl+Space to execute it
log('Before json.set');
json.set(vscope.person, 'name', 'James');
json.set(vscope.person, 'age', 40);
log('After json.set');
hsp.refresh();
var friend = {
name : 'Peter',
age : 30
};
# template welcome(person)
Hello {person.name}, you're {:person.age} years old and you're age won't change
# /template
// In this file you can have multiple templates or JavaScript object
// this line tells the editor which template should be displayed in the output panel
// and what are its arguments (second parameter should be an array)
display(welcome, [friend]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.