Commit 9f010430 authored by lucas.coatanlem's avatar lucas.coatanlem
Browse files

End of js_to_cduce for the strings, trying to work on numbers and objects now.

parent 1baf9c81
...@@ -76,9 +76,20 @@ let simple_js_to_cduce v = ...@@ -76,9 +76,20 @@ let simple_js_to_cduce v =
let js_to_cduce e = let js_to_cduce e =
let open Ns in
let js_get_properties = Js.Unsafe.get Dom_html.window (Js.string "js_get_properties") in let js_get_properties = Js.Unsafe.get Dom_html.window (Js.string "js_get_properties") in
let _content = Js.Unsafe.fun_call js_get_properties [| (Js.Unsafe.inject e) |] in let content = Js.Unsafe.fun_call js_get_properties [| (Js.Unsafe.inject e) |] in
assert false let res = ref [] in
let size = Array.length content in
begin
for i = 0 to size - 1 do
let (n,v) = content.(i) in
match simple_js_to_cduce v with
None -> ()
| Some vcduce -> res := (Label.mk_ascii (Js.to_string n), vcduce) :: !res
done;
Value.vrecord !res
end
(* initialiser une ref à [], (* initialiser une ref à [],
pour chaque ligne dans content (name : n, value : v), pour chaque ligne dans content (name : n, value : v),
match simple_js_to_cduce v with match simple_js_to_cduce v with
...@@ -108,7 +119,7 @@ let register_event id event handler = ...@@ -108,7 +119,7 @@ let register_event id event handler =
let define_prims () = let define_prims () =
(* define js primitives one at the moment *) (* define js primitives (one at the moment) *)
Js.Unsafe.eval_string " Js.Unsafe.eval_string "
window.js_get_properties = function (o){ window.js_get_properties = function (o){
var res = []; var res = [];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment