crelte / plugins / Events
Class: Events
Constructors
Constructor
new Events(): Events;Returns
Events
Properties
inner
inner: Map<string, Set<any>>;Methods
getListeners()
getListeners(ev): (cr) =>
| Entry
| Promise<Entry | null>
| null[];Get all listeners for an event
Parameters
ev
"loadEntry"
Returns
(cr) => | Entry | Promise<Entry | null> | null[]
has()
has(ev): boolean;Check if an event has listeners
Parameters
ev
string
Returns
boolean
on()
Call Signature
on(ev, fn): () => void;Listens for an event.
beforeRequest
Please prefer to return not return a promise only if you need to wait for something. This allows a push request to be done without a microtask. Allowing for a better DX.
loadEntry
This will execute all listeners in sequence and stop on the first one which returns an entry. Will be executed in preload as well.
beforeQueryEntry
This allows to modify the entry query variables before the entry query is executed. Will be executed in preload as well.
afterLoadEntry
Will be executed in preload as well.
Parameters
ev
"beforeRequest"
fn
(cr) => void | Promise<void>
Returns
a function to remove the listener
(): void;Returns
void
Call Signature
on(ev, fn): () => void;Listens for an event.
beforeRequest
Please prefer to return not return a promise only if you need to wait for something. This allows a push request to be done without a microtask. Allowing for a better DX.
loadEntry
This will execute all listeners in sequence and stop on the first one which returns an entry. Will be executed in preload as well.
beforeQueryEntry
This allows to modify the entry query variables before the entry query is executed. Will be executed in preload as well.
afterLoadEntry
Will be executed in preload as well.
Parameters
ev
"loadGlobalData"
fn
(cr) => any
Returns
a function to remove the listener
(): void;Returns
void
Call Signature
on(ev, fn): () => void;Listens for an event.
beforeRequest
Please prefer to return not return a promise only if you need to wait for something. This allows a push request to be done without a microtask. Allowing for a better DX.
loadEntry
This will execute all listeners in sequence and stop on the first one which returns an entry. Will be executed in preload as well.
beforeQueryEntry
This allows to modify the entry query variables before the entry query is executed. Will be executed in preload as well.
afterLoadEntry
Will be executed in preload as well.
Parameters
ev
"loadEntry"
fn
(cr) => | Entry | Promise<Entry | null> | null
Returns
a function to remove the listener
(): void;Returns
void
Call Signature
on(ev, fn): () => void;Listens for an event.
beforeRequest
Please prefer to return not return a promise only if you need to wait for something. This allows a push request to be done without a microtask. Allowing for a better DX.
loadEntry
This will execute all listeners in sequence and stop on the first one which returns an entry. Will be executed in preload as well.
beforeQueryEntry
This allows to modify the entry query variables before the entry query is executed. Will be executed in preload as well.
afterLoadEntry
Will be executed in preload as well.
Parameters
ev
"beforeQueryEntry"
fn
(cr, vars) => void | Promise<void>
Returns
a function to remove the listener
(): void;Returns
void
Call Signature
on(ev, fn): () => void;Listens for an event.
beforeRequest
Please prefer to return not return a promise only if you need to wait for something. This allows a push request to be done without a microtask. Allowing for a better DX.
loadEntry
This will execute all listeners in sequence and stop on the first one which returns an entry. Will be executed in preload as well.
beforeQueryEntry
This allows to modify the entry query variables before the entry query is executed. Will be executed in preload as well.
afterLoadEntry
Will be executed in preload as well.
Parameters
ev
"afterLoadEntry"
fn
(cr) => any
Returns
a function to remove the listener
(): void;Returns
void
Call Signature
on(ev, fn): () => void;Listens for an event.
beforeRequest
Please prefer to return not return a promise only if you need to wait for something. This allows a push request to be done without a microtask. Allowing for a better DX.
loadEntry
This will execute all listeners in sequence and stop on the first one which returns an entry. Will be executed in preload as well.
beforeQueryEntry
This allows to modify the entry query variables before the entry query is executed. Will be executed in preload as well.
afterLoadEntry
Will be executed in preload as well.
Parameters
ev
"loadData"
fn
(cr, entry) => any
Returns
a function to remove the listener
(): void;Returns
void
Call Signature
on(ev, fn): () => void;Listens for an event.
beforeRequest
Please prefer to return not return a promise only if you need to wait for something. This allows a push request to be done without a microtask. Allowing for a better DX.
loadEntry
This will execute all listeners in sequence and stop on the first one which returns an entry. Will be executed in preload as well.
beforeQueryEntry
This allows to modify the entry query variables before the entry query is executed. Will be executed in preload as well.
afterLoadEntry
Will be executed in preload as well.
Parameters
ev
"beforeRender"
fn
(cr) => void
Returns
a function to remove the listener
(): void;Returns
void
remove()
remove(ev, fn): void;Remove a listener
Parameters
ev
string
fn
any
Returns
void
trigger()
Call Signature
trigger(ev, cr): (void | Promise<void>)[];Trigger an event
Parameters
ev
"beforeRequest"
cr
Returns
(void | Promise<void>)[]
Call Signature
trigger(ev, cr): any[];Trigger an event
Parameters
ev
"loadGlobalData"
cr
Returns
any[]
Call Signature
trigger(
ev,
cr,
vars): (void | Promise<void>)[];Trigger an event
Parameters
ev
"beforeQueryEntry"
cr
vars
Returns
(void | Promise<void>)[]
Call Signature
trigger(ev, cr): any[];Trigger an event
Parameters
ev
"afterLoadEntry"
cr
Returns
any[]
Call Signature
trigger(
ev,
cr,
entry): any[];Trigger an event
Parameters
ev
"loadData"
cr
entry
Returns
any[]
Call Signature
trigger(
ev,
cr,
route): void[];Trigger an event
Parameters
ev
"beforeRender"
cr
route
Returns
void[]