#include <event_target.h>
Definition at line 40 of file event_target.h.
§ Listener
§ EventTarget()
shaka::js::events::EventTarget::EventTarget |
( |
| ) |
|
§ AddEventListener()
void shaka::js::events::EventTarget::AddEventListener |
( |
const std::string & |
type, |
|
|
Listener |
callback |
|
) |
| |
Adds a js-backed event listener to the target.
- Parameters
-
type | The name of the event to listen for. |
callback | The listener for the event. Must be a function. |
Definition at line 41 of file event_target.cc.
§ AddListenerField()
void shaka::js::events::EventTarget::AddListenerField |
( |
EventType |
type, |
|
|
Listener * |
on_field |
|
) |
| |
|
inlineprotected |
§ DispatchEvent()
Dispatches the event to the current object. This method blocks until the event is complete. The event is treated as not trusted even if it comes from internal code (Shaka Player doesn't care). This must be called from the event thread.
- Parameters
-
event | The event to dispatch. |
- Returns
- False if one listener called preventDefault, otherwise true.
Definition at line 86 of file event_target.h.
§ DispatchEventInternal()
ExceptionOr< bool > shaka::js::events::EventTarget::DispatchEventInternal |
( |
RefPtr< Event > |
event, |
|
|
bool * |
did_listeners_throw |
|
) |
| |
- See also
- DispatchEvent
- Parameters
-
event | The event to dispatch |
did_listeners_throw | [OUT] If given, will be set to whether a listener threw an exception. |
- Returns
- False if one listener called preventDefault, otherwise true.
Definition at line 68 of file event_target.cc.
§ RaiseEvent()
template<typename EventType , typename... Args>
ExceptionOr<bool> shaka::js::events::EventTarget::RaiseEvent |
( |
Args... |
args | ) |
|
|
inline |
Synchronously raises the given event on this. This must only be called from the event thread.
Definition at line 131 of file event_target.h.
§ RemoveEventListener()
void shaka::js::events::EventTarget::RemoveEventListener |
( |
const std::string & |
type, |
|
|
Listener |
callback |
|
) |
| |
Removes a js-backed event listener from the target.
- Parameters
-
type | The name of the event to remove. |
callback | The listener to remove. |
Definition at line 52 of file event_target.cc.
§ ScheduleEvent()
template<typename EventType , typename... Args>
std::shared_ptr<ThreadEvent<bool> > shaka::js::events::EventTarget::ScheduleEvent |
( |
Args &&... |
args | ) |
|
|
inline |
Asynchronously raises the given event on this. It is safe to call this from any thread. There needs to be an explicit type parameter for the type of event to raise, the remaining types should be arguments to its constructor. The constructor used does not need to be the one used from JavaScript.
Definition at line 108 of file event_target.h.
§ SetCppEventListener()
void shaka::js::events::EventTarget::SetCppEventListener |
( |
EventType |
type, |
|
|
std::function< void()> |
callback |
|
) |
| |
Adds a not-js-backed event listener to the target. There should only be one such event listener per event.
- Parameters
-
type | The name of the event to listen for. |
callback | The listener for the event. Must be a function. |
Definition at line 47 of file event_target.cc.
§ Trace()
Doxygen_Skip void shaka::js::events::EventTarget::Trace |
( |
memory::HeapTracer * |
tracer | ) |
const |
|
overridevirtual |
Called during a GC run. This should call HeapTracer::Trace on all Traceable members. Be sure to call the base method when overriding.
Implements shaka::memory::Traceable.
Reimplemented in shaka::js::idb::IDBIterateCursorRequest, shaka::js::XMLHttpRequest, shaka::js::mse::TrackList< JsTrack, PubTrack >, shaka::js::mse::TrackList< AudioTrack, media::MediaTrack >, shaka::js::mse::TrackList< VideoTrack, media::MediaTrack >, shaka::js::mse::TrackList< TextTrack, media::TextTrack >, shaka::js::mse::HTMLMediaElement, shaka::js::mse::MediaSource, shaka::js::idb::IDBTransaction, shaka::js::idb::IDBDatabase, shaka::js::idb::IDBRequest, shaka::js::mse::SourceBuffer, and shaka::js::mse::TextTrack.
Definition at line 31 of file event_target.cc.
§ UnsetCppEventListener()
void shaka::js::events::EventTarget::UnsetCppEventListener |
( |
EventType |
type | ) |
|
Removes a not-js-backed event listener from the target.
- Parameters
-
type | The name of the event to remove. |
Definition at line 64 of file event_target.cc.
The documentation for this class was generated from the following files: