add simple storage demo app

This commit is contained in:
Iuri Matias 2015-05-24 09:07:19 -04:00
parent a4fe027fb3
commit 8d1ebe9ba0
7 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,9 @@
contract SimpleStorage {
uint storedData;
function set(uint x) {
storedData = x;
}
function get() constant returns (uint retVal) {
return storedData;
}
}

0
demo/css/.gitkeep Normal file
View File

5
demo/css/main.css Normal file
View File

@ -0,0 +1,5 @@
div {
margin: 15px;
}

24
demo/html/index.html Normal file
View File

@ -0,0 +1,24 @@
<html>
<head>
<title>Embark - SimpleStorage Demo</title>
<link rel="stylesheet" href="css/app.min.css">
<script src="js/app.min.js"></script>
</head>
<body>
<h3>Embark - SimpleStorage Demo</h3>
<div>
<input type="text" class="text" value="10">
<button class="set">Set Value</button>
</div>
<div>
<button class="get">Get Value</button>
<br>value is <span class="value"></span>
</div>
<div class="logs">
</div>
</body>
</html>

0
demo/js/.gitkeep Normal file
View File

5
demo/js/_vendor/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

19
demo/js/index.js Normal file
View File

@ -0,0 +1,19 @@
$(document).ready(function() {
$("button.set").click(function() {
var value = parseInt($("input.text").val(), 10);
SimpleStorage.set(value);
addToLog("SimpleStorage.set("+value+")");
});
document.getElementsByClassName("get")[0].addEventListener('click', function() {
var value = SimpleStorage.get().toNumber();
$(".value").html(value);
addToLog("SimpleStorage.get()");
});
var addToLog = function(txt) {
$(".logs").append("<br>" + txt);
}
});