Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 5c7f9f5

Browse files
author
Barrie Hadfield
committed
example
1 parent ba6d8dd commit 5c7f9f5

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ First add React, JQuery, `hyperloop.js` and `opal-compiler.js` to your HTML page
4242
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
4343

4444
<!-- Opal and Hyperloop -->
45-
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/opal-compiler.min.js"></script>
46-
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/hyperloop.min.js"></script>
45+
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/master/opal-compiler.min.js"></script>
46+
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/master/hyperloop.min.js"></script>
4747
</head>
4848
```
4949

@@ -86,8 +86,8 @@ index.html:
8686
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
8787

8888
<!-- Opal and Hyperloop -->
89-
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/opal-compiler.min.js"></script>
90-
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/hyperloop.min.js"></script>
89+
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/master/opal-compiler.min.js"></script>
90+
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/master/hyperloop.min.js"></script>
9191

9292
<script type="text/ruby">
9393
class SayHello < Hyperloop::Component

index.html

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,30 @@
44
<head>
55
<meta charset="utf-8">
66
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7-
<title>Reactrb-Express Demo</title>
7+
<title>Hyperloop JS Demo</title>
8+
9+
<!-- React and JQuery -->
10+
<script src="https://unpkg.com/react@15/dist/react.min.js"></script>
11+
<script src="https://unpkg.com/react-dom@15/dist/react-dom.min.js"></script>
812
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
9-
<!--
10-
<script src="https://rawgit.com/reactrb/reactrb-express/master/reactrb-express.js"></script>
11-
-->
12-
<script src="reactrb-express.min.js"></script>
1313

14-
<!-- ruby scripts can be fetched from the server or other remote source -->
15-
<script type="text/ruby" src="clock.rb"></script>
14+
<!-- Opal and Hyperloop -->
15+
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/master/opal-compiler.min.js"></script>
16+
<script src="https://rawgit.com/ruby-hyperloop/hyperloop-js/master/hyperloop.min.js"></script>
1617

17-
<!-- or the ruby code can specified directly inline -->
1818
<script type="text/ruby">
19-
Element['#clock'].render do
20-
Clock format: 'The time is: %a, %e %b %Y %H:%M:%S %z'
19+
class SimpleComponent < Hyperloop::Component
20+
render(DIV) do
21+
BUTTON { 'Push the button' }.on(:click) do
22+
alert 'You did it!'
23+
end
24+
end
2125
end
2226
</script>
23-
2427
</head>
25-
<body>
26-
<div id="clock"></div>
27-
<!--
2828

29-
instead of using Element[...].render to attach a top level component, you
30-
can specify the react component and parameters using data- tags:
31-
32-
<div data-reactrb-mount="Clock"
33-
data-format="The time is: %a, %e %b %Y %H:%M:%S %z">
29+
<body>
30+
<div data-hyperloop-mount="SimpleComponent">
3431
</div>
35-
36-
-->
3732
</body>
3833
</html>

0 commit comments

Comments
 (0)