Skip to content

Commit 1051121

Browse files
committedJun 15, 2014
Merge pull request #1 from Engil/master
Fix compilation error with the latest goji and goji-lib-browser
2 parents 1ca32d8 + 1367af7 commit 1051121

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed
 

‎descriptions/canvas.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let canvas_component =
2525
~doc:"A drawing context lets you draw on the canvas"
2626
"gl_context" (abstract any) ;
2727
section "Canvas Element Management" [
28-
inherits ([], "canvas") ([], "Document.node") "as_node" ;
28+
inherits ([], "canvas") ([], "Browser.DOM.node") "as_node" ;
2929
map_attribute "canvas" "width"
3030
~doc:"Reflects the height HTML attribute, specifying the width of \
3131
the coordinate space in CSS pixels."
@@ -38,15 +38,15 @@ let canvas_component =
3838
~doc:"Obtain a 2D context, should work everywhere"
3939
[]
4040
(abs "_"
41-
(set (arg 0) Const.(string "2d"))
41+
(set_const (arg 0) Const.(string "2d"))
4242
(call_method "getContext"))
4343
(abbrv "context") ;
4444
def_method "canvas" "get_gl_context"
4545
~doc:"Obtain a 3D context, works only on browsers supporting \
4646
WebGL"
4747
[]
4848
(abs "_"
49-
(set (arg 0) Const.(string "webgl"))
49+
(set_const (arg 0) Const.(string "webgl"))
5050
(call_method "getContext"))
5151
(abbrv "gl_context") ;
5252
] ;

‎descriptions/raphael.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ let raphael_component =
208208
~doc:"Gives you a reference to the DOM object, so you can assign \
209209
event handlers or just mess around.\n\
210210
Note: Don't mess with it."
211-
~read_only:true (abbrv "Document.node") ;
211+
~read_only:true (abbrv "Browser.DOM.node") ;
212212
map_attribute "t" "id"
213213
~doc:"Unique id of the element. Especially usesful when you want \
214214
to listen to events of the element, because all events are \
@@ -831,7 +831,7 @@ let raphael_component =
831831

832832
[ labeled_arg "node"
833833
~doc:"the parent DOM node"
834-
((abbrv "Document.node") @@ arg 0) ;
834+
((abbrv "Browser.DOM.node") @@ arg 0) ;
835835
labeled_arg "width"
836836
~doc:"the width in pixels"
837837
(int @@ arg 1) ;
@@ -1550,7 +1550,7 @@ let raphael_component =
15501550

15511551
[ labeled_arg "node"
15521552
~doc:"the parent DOM node"
1553-
((abbrv "Document.node") @@ arg 0) ;
1553+
((abbrv "Browser.DOM.node") @@ arg 0) ;
15541554
labeled_arg "width"
15551555
~doc:"the width in pixels"
15561556
(int @@ arg 1) ;

‎examples/cacophonie/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<html>
2-
<body>
2+
<body id="body">
33
</body>
44
<script src="libs.js" type="text/javascript"></script>
55
<script src="main.js" type="text/javascript"></script>

‎examples/cacophonie/main.ml

+9-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ open JavaScript
77
open Raphael
88
open Howler
99

10+
module Dom = Browser.DOM
11+
1012
let looping_rotation ?(center = 0., 0.) ?(start = 0.) element duration =
1113
let rec loop deg =
1214
let matrix = Matrix.identity () in
@@ -33,8 +35,13 @@ let scale =
3335
fun i -> scale.(i)
3436

3537
let _ =
36-
let canvas = Document.create "div" in
37-
Document.append (Document.body ()) canvas ;
38+
let document = Dom.document in
39+
let body =
40+
match Dom.get_element_by_id document "body" with
41+
| None -> assert false
42+
| Some elt -> elt in
43+
let canvas = Dom.create_element_mode "div" in
44+
Dom.append_child (Dom.element_as_node body) canvas;
3845
let paper = raphael_at_node canvas 500 500 in
3946
Paper.set_start paper ;
4047
for i = 15 downto 0 do

0 commit comments

Comments
 (0)
Please sign in to comment.