Edit this page

up.event up.event.build([type], [props])
JavaScript function

This feature is experimental. Please share your experiences so we know what to keep or change.

Builds an event with the given type and properties.

The returned event is not emitted.

Example

let event = up.event.build('my:event', { foo: 'bar' })
console.log(event.type)              // logs "my:event"
console.log(event.foo)               // logs "bar"
console.log(event.defaultPrevented)  // logs "false"
up.emit(event)                       // emits the event

Parameters

[type] string optional

The event type.

May also be passed as a property { type }.

[props={}] Object optional

An object with event properties.

[props.type] string optional

The event type.

May also be passed as a first string argument.

Return value