25 #ifndef __AAMP_JSEVENT_H__
26 #define __AAMP_JSEVENT_H__
28 #include <JavaScriptCore/JavaScript.h>
35 #ifdef JSEVENT_WITH_NATIVE_MEMORY
66 AAMPJSEvent(
const char *type,
bool bubble,
bool cancelable);
71 AAMPJSEvent(
const AAMPJSEvent&) =
delete;
76 AAMPJSEvent& operator=(
const AAMPJSEvent&) =
delete;
87 void initEvent(
const char *type,
bool bubble,
bool cancelable);
93 const char* getType() {
return _typeName; }
99 bool getBubbles() {
return _bubbles; }
105 bool getCancelable() {
return _cancelable; }
111 JSObjectRef getTarget() {
return _target; }
117 JSObjectRef getCurrentTarget() {
return _currentTarget; }
123 EventPhase getEventPhase() {
return _phase; }
129 bool getIsDefaultPrevented() {
return _canceled; }
135 bool getIsTrusted() {
return _isTrusted; }
141 double getTimestamp() {
return _timestamp; }
146 void preventDefault()
155 void stopImmediatePropagation()
157 _stopImmediatePropagation =
true;
163 void stopPropagation()
165 _stopPropagation =
true;
173 void setTarget(JSContextRef context, JSObjectRef obj)
181 JSValueUnprotect(_ctx, _target);
184 JSValueProtect(_ctx, _target);
192 void setCurrentTarget(JSContextRef context, JSObjectRef obj)
200 JSValueUnprotect(_ctx, _currentTarget);
202 _currentTarget = obj;
203 JSValueProtect(_ctx, _currentTarget);
210 JSObjectRef _currentTarget;
211 bool _defaultPrevented;
215 const char * _typeName;
218 bool _stopImmediatePropagation;
219 bool _stopPropagation;
233 JSObjectRef
createNewAAMPJSEvent(JSGlobalContextRef ctx,
const char *type,
bool bubbles,
bool cancelable);
235 #endif // __AAMP_JSEVENT_H__