counter.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Trapped - Counter example</title>
  5. <style>
  6. [data-trap] {
  7. display: none
  8. }
  9. button {
  10. font-family: monospace;
  11. }
  12. </style>
  13. <meta name="author" content="Herbert Vojčík"/>
  14. <script type='text/javascript' src='../the.js'></script>
  15. <script type="text/javascript">
  16. var blackboard;
  17. require.config({baseUrl: '..'});
  18. require(["app", "trapped-counter/Trapped-Counter"], function (amberPromise) {
  19. Promise.resolve(amberPromise).then(function (amber) {
  20. amber.initialize({
  21. //used for all new packages in IDE
  22. 'transport.defaultAmdNamespace': "trapped-counter"
  23. }).then(function () {
  24. require(["amber-ide-starter-dialog"], function (dlg) { dlg.start(); });
  25. $(function () {
  26. blackboard = amber.globals.TrappedCounter._new();
  27. amber.globals.Trapped._start_([blackboard]);
  28. });
  29. });
  30. });
  31. });
  32. </script>
  33. </head>
  34. <body>
  35. <h2 data-trap="TrappedCounter ~value"></h2>
  36. <button data-trap="TrappedCounter: (signal increment) whenClicked">++</button>
  37. <button data-trap="TrappedCounter: (signal decrement) whenClicked">--</button>
  38. </body>
  39. </html>