Skip to content

Instantly share code, notes, and snippets.

@kctang
Created July 27, 2014 01:40
Show Gist options
  • Save kctang/3007d01a500f2d86012c to your computer and use it in GitHub Desktop.
Save kctang/3007d01a500f2d86012c to your computer and use it in GitHub Desktop.
doctype
html
head
script(rel='import', src='bower_components/platform/platform.js')
link(rel='import', href='bower_components/polymer/polymer.html')
link(rel='import', href='bower_components/core-localstorage/core-localstorage.html')
body
my-app
polymer-element(name='my-app')
template
#app I am number {{model.count}}
button(on-click='{{increment}}') Increment
button(on-click='{{save}}') Save
button(on-click='{{reset}}') Reset
core-localstorage#storage(name='my-app',value='{{model}}')
script.
Polymer('my-app', {
model: { count: 0 },
increment: function () {
this.model.count++;
},
reset: function () {
this.model.count = 0;
},
save: function () {
this.$.storage.save();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment