Mercurial > molko
comparison molko-js/src/js-window.c @ 200:dd77bfb38df2
js: cleanup API
Since molko-js API isn't meant to be exposed, use duk_context everywhere by
default for a simpler code.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 09 Nov 2020 19:18:14 +0100 |
parents | 633a25df450e |
children |
comparison
equal
deleted
inserted
replaced
199:ebbcfb31482d | 200:dd77bfb38df2 |
---|---|
71 { "HAND", WINDOW_CURSOR_HAND }, | 71 { "HAND", WINDOW_CURSOR_HAND }, |
72 { NULL, 0 } | 72 { NULL, 0 } |
73 }; | 73 }; |
74 | 74 |
75 void | 75 void |
76 js_window_load(struct js *js) | 76 js_window_load(duk_context *ctx) |
77 { | 77 { |
78 assert(js); | 78 assert(ctx); |
79 | 79 |
80 duk_push_global_object(js->handle); // [g] | 80 duk_push_global_object(ctx); |
81 duk_get_prop_string(js->handle, -1, "Molko"); // [g] [Molko] | 81 duk_get_prop_string(ctx, -1, "Molko"); |
82 duk_push_c_function(js->handle, js_window_new, 3); // [g] [Molko] [Window] | 82 duk_push_c_function(ctx, js_window_new, 3); |
83 duk_push_object(js->handle); // [g] [Molko] [Window] [Cursor] | 83 duk_push_object(ctx); |
84 duk_put_number_list(js->handle, -1, cursors); | 84 duk_put_number_list(ctx, -1, cursors); |
85 duk_put_prop_string(js->handle, -2, "Cursor"); // [g] [Molko] [Window] | 85 duk_put_prop_string(ctx, -2, "Cursor"); |
86 duk_put_prop_string(js->handle, -2, "Window"); | 86 duk_put_prop_string(ctx, -2, "Window"); |
87 duk_pop_n(js->handle, 2); | 87 duk_pop_n(ctx, 2); |
88 } | 88 } |