Skip to content

Commit b6d468f

Browse files
committed
Js_of_ocaml TodoMVC Example.
Js_of_ocaml is a compiler of OCaml bytecode to Javascript. OCaml is a general purpose programming language with an emphasis on expressiveness and safety. Js_of_ocaml brings nearly all the OCaml features to Javascript. And especially its powerful type system.
1 parent 26bfec3 commit b6d468f

File tree

16 files changed

+4804
-0
lines changed

16 files changed

+4804
-0
lines changed

.jscsrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"examples/duel/www/**",
3131
"examples/duel/src/main/webapp/js/lib/**",
3232
"examples/polymer/elements/elements.build.js",
33+
"examples/js_of_ocaml/js/*.js",
3334
"**/generated/**"
3435
],
3536
"requireSpaceBeforeBlockStatements": true,

examples/js_of_ocaml/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_build
2+
3+
*.byte

examples/js_of_ocaml/.jshintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
js/todomvc.js

examples/js_of_ocaml/build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
# Compile OCaml source file to OCaml bytecode
4+
ocamlbuild -use-ocamlfind \
5+
-tags "warn(-40)" \
6+
-pkgs lwt.syntax,js_of_ocaml,js_of_ocaml.syntax,js_of_ocaml.tyxml,tyxml,js_of_ocaml.deriving,js_of_ocaml.deriving.syntax,deriving \
7+
-syntax camlp4o \
8+
todomvc.byte ;
9+
10+
# Build JS code from the OCaml bytecode
11+
js_of_ocaml +weak.js --opt 3 -o js/todomvc.js todomvc.byte

examples/js_of_ocaml/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>Js_of_ocaml • TodoMVC</title>
7+
<link rel="stylesheet" href="node_modules/todomvc-common/base.css">
8+
<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
9+
</head>
10+
<body>
11+
<div id="todomvc" class="todoapp"></div>
12+
<script src="js/todomvc.js"></script>
13+
</body>
14+
</html>

examples/js_of_ocaml/js/todomvc.js

Lines changed: 3263 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)