core_block/events

Javascript events for the core_block subsystem.

Source:
Since:
  • 4.0
License:
  • http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Example

Example of listening to a block event.

import {eventTypes as blockEventTypes} from 'core_block/events';

document.addEventListener(blockEventTypes.blockContentUpdated, e => {
    window.console.log(e.target); // The HTMLElement relating to the block whose content was updated.
    window.console.log(e.detail.instanceId); // The instanceId of the block that was updated.
});

Members

(static, constant) eventTypes

Source:
Properties:
Name Type Description
blockContentUpdated String

See event:blockContentUpdated

Events for core_block.

Methods

(inner) notifyBlockContentUpdated(element) → {CustomEvent}

Source:

Trigger an event to indicate that the content of a block was updated.

Parameters:
Name Type Description
element HTMLElement

The HTMLElement containing the updated block.

Fires:
Returns:
Type
CustomEvent

Events

blockContentUpdated

Source:
Properties:
Name Type Description
target HTMLElement

The block element that was updated

detail object
Properties
Name Type Description
instanceId number

The block instance id

An event triggered when the content of a block has changed.

Type:
  • CustomEvent