mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-29 03:17:53 -04:00
[mujs] event.cancelable
This commit is contained in:
parent
86bf551d54
commit
0da45fcfd0
@ -16,10 +16,18 @@
|
|||||||
#include "intl/charsets.h"
|
#include "intl/charsets.h"
|
||||||
#include "terminal/event.h"
|
#include "terminal/event.h"
|
||||||
|
|
||||||
|
static void mjs_event_get_property_bubbles(js_State *J);
|
||||||
|
static void mjs_event_get_property_cancelable(js_State *J);
|
||||||
|
static void mjs_event_get_property_composed(js_State *J);
|
||||||
|
static void mjs_event_get_property_defaultPrevented(js_State *J);
|
||||||
static void mjs_event_get_property_type(js_State *J);
|
static void mjs_event_get_property_type(js_State *J);
|
||||||
|
|
||||||
struct eljs_event {
|
struct eljs_event {
|
||||||
char *type_;
|
char *type_;
|
||||||
|
unsigned int bubbles:1;
|
||||||
|
unsigned int cancelable:1;
|
||||||
|
unsigned int composed:1;
|
||||||
|
unsigned int defaultPrevented:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -47,10 +55,74 @@ mjs_push_event(js_State *J, char *type_)
|
|||||||
js_newobject(J);
|
js_newobject(J);
|
||||||
{
|
{
|
||||||
js_newuserdata(J, "event", event, mjs_event_finalizer);
|
js_newuserdata(J, "event", event, mjs_event_finalizer);
|
||||||
|
addproperty(J, "bubbles", mjs_event_get_property_bubbles, NULL);
|
||||||
|
addproperty(J, "cancelable", mjs_event_get_property_cancelable, NULL);
|
||||||
|
addproperty(J, "composed", mjs_event_get_property_composed, NULL);
|
||||||
|
addproperty(J, "defaultPrevented", mjs_event_get_property_defaultPrevented, NULL);
|
||||||
addproperty(J, "type", mjs_event_get_property_type, NULL);
|
addproperty(J, "type", mjs_event_get_property_type, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mjs_event_get_property_bubbles(js_State *J)
|
||||||
|
{
|
||||||
|
#ifdef ECMASCRIPT_DEBUG
|
||||||
|
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||||
|
#endif
|
||||||
|
struct eljs_event *event = (struct eljs_event *)js_touserdata(J, 0, "event");
|
||||||
|
|
||||||
|
if (!event) {
|
||||||
|
js_pushnull(J);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
js_pushboolean(J, event->bubbles);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mjs_event_get_property_cancelable(js_State *J)
|
||||||
|
{
|
||||||
|
#ifdef ECMASCRIPT_DEBUG
|
||||||
|
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||||
|
#endif
|
||||||
|
struct eljs_event *event = (struct eljs_event *)js_touserdata(J, 0, "event");
|
||||||
|
|
||||||
|
if (!event) {
|
||||||
|
js_pushnull(J);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
js_pushboolean(J, event->cancelable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mjs_event_get_property_composed(js_State *J)
|
||||||
|
{
|
||||||
|
#ifdef ECMASCRIPT_DEBUG
|
||||||
|
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||||
|
#endif
|
||||||
|
struct eljs_event *event = (struct eljs_event *)js_touserdata(J, 0, "event");
|
||||||
|
|
||||||
|
if (!event) {
|
||||||
|
js_pushnull(J);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
js_pushboolean(J, event->composed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mjs_event_get_property_defaultPrevented(js_State *J)
|
||||||
|
{
|
||||||
|
#ifdef ECMASCRIPT_DEBUG
|
||||||
|
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||||
|
#endif
|
||||||
|
struct eljs_event *event = (struct eljs_event *)js_touserdata(J, 0, "event");
|
||||||
|
|
||||||
|
if (!event) {
|
||||||
|
js_pushnull(J);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
js_pushboolean(J, event->defaultPrevented);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mjs_event_get_property_type(js_State *J)
|
mjs_event_get_property_type(js_State *J)
|
||||||
{
|
{
|
||||||
@ -91,6 +163,10 @@ mjs_event_constructor(js_State *J)
|
|||||||
js_newobject(J);
|
js_newobject(J);
|
||||||
{
|
{
|
||||||
js_newuserdata(J, "event", event, mjs_event_finalizer);
|
js_newuserdata(J, "event", event, mjs_event_finalizer);
|
||||||
|
addproperty(J, "bubbles", mjs_event_get_property_bubbles, NULL);
|
||||||
|
addproperty(J, "cancelable", mjs_event_get_property_cancelable, NULL);
|
||||||
|
addproperty(J, "composed", mjs_event_get_property_composed, NULL);
|
||||||
|
addproperty(J, "defaultPrevented", mjs_event_get_property_defaultPrevented, NULL);
|
||||||
addproperty(J, "type", mjs_event_get_property_type, NULL);
|
addproperty(J, "type", mjs_event_get_property_type, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user