embark/demo/app/js/index.js

23 lines
501 B
JavaScript
Raw Normal View History

/*globals $, SimpleStorage, document*/
var addToLog = function(txt) {
$(".logs").append("<br>" + txt);
};
2015-05-24 13:07:19 +00:00
$(document).ready(function() {
$("button.set").click(function() {
var value = parseInt($("input.text").val(), 10);
SimpleStorage.set(value);
addToLog("SimpleStorage.set(" + value + ")");
2015-05-24 13:07:19 +00:00
});
2016-05-23 15:10:24 +00:00
$("button.get").click(function() {
SimpleStorage.get().then(function(value) {
$(".value").html(value.toNumber());
});
2015-05-24 13:07:19 +00:00
addToLog("SimpleStorage.get()");
});
});