Button example

This commit is contained in:
Tony Garnock-Jones 2016-03-22 12:11:56 -04:00
parent da978aad39
commit e7c7a7cdfa
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,19 @@
<!doctype html>
<html>
<head>
<title>Syndicate: Button Example</title>
<meta charset="utf-8">
<link href="style.css" rel="stylesheet">
<script src="../../third-party/jquery-2.2.0.min.js"></script>
<script src="../../dist/syndicatecompiler.js"></script>
<script src="../../dist/syndicate.js"></script>
<script type="text/syndicate-js" src="index.js"></script>
</head>
<body>
<h1>Button Example</h1>
<button id="counter"><span id="button-label"></span></button>
<p>
Source code: <a href="index.js">index.js</a>
</p>
</body>
</html>

View File

@ -0,0 +1,19 @@
assertion type DOM(containerSelector, fragmentClass, spec);
assertion type jQuery(selector, eventType, event);
$(document).ready(function() {
ground network {
Syndicate.DOM.spawnDOMDriver();
Syndicate.JQuery.spawnJQueryDriver();
actor {
this.counter = 0;
forever {
assert DOM('#button-label', '', Syndicate.seal(this.counter));
on message jQuery('#counter', 'click', _) {
this.counter++;
}
}
}
}
});