mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 16:15:10 +00:00
LibWeb: Add Bindings::ScriptExecutionContext
This will be inherited by documents and workers, to provide a common abstraction for script execution. (We don't have workers yet, but we might as well make this little space for them now to simplify things down the road.)
This commit is contained in:
parent
976e55e942
commit
c6ae0c41d9
11 changed files with 100 additions and 8 deletions
|
@ -49,6 +49,7 @@ public:
|
|||
|
||||
virtual void dispatch_event(NonnullRefPtr<Event>) = 0;
|
||||
virtual Bindings::EventTargetWrapper* create_wrapper(JS::GlobalObject&) = 0;
|
||||
Bindings::ScriptExecutionContext* script_execution_context() { return m_script_execution_context; }
|
||||
|
||||
struct EventListenerRegistration {
|
||||
FlyString event_name;
|
||||
|
@ -58,12 +59,15 @@ public:
|
|||
const Vector<EventListenerRegistration>& listeners() const { return m_listeners; }
|
||||
|
||||
protected:
|
||||
EventTarget();
|
||||
explicit EventTarget(Bindings::ScriptExecutionContext&);
|
||||
|
||||
virtual void ref_event_target() = 0;
|
||||
virtual void unref_event_target() = 0;
|
||||
|
||||
private:
|
||||
// FIXME: This should not be a raw pointer.
|
||||
Bindings::ScriptExecutionContext* m_script_execution_context { nullptr };
|
||||
|
||||
Vector<EventListenerRegistration> m_listeners;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue