PluginProbe
Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts / trunk
Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts vtrunk
2.8.14 2.8.13 2.8.12 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.10 2.8.11 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 trunk 1.0.1 1.0.2 1.1.0 1.1.1 All 147 releases
content-blocks-builder / src / utils / dom / event.js

event.js in Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts trunk, at src/utils/dom/event.js

44 lines 695 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Internal dependencies
3 */
4 import { exposeHelper } from "./utils";
5
6 /**
7 * Events
8 */
9 const EVENTS = {
10 SHOW: "show.boldblocks",
11 SHOWN: "shown.boldblocks",
12 HIDE: "hide.boldblocks",
13 HIDDEN: "hidden.boldblocks",
14 INIT: "init.boldblocks",
15 };
16
17 /**
18 * Trigger an event
19 *
20 * @param {Node} element
21 * @param {String} eventName
22 * @param {Object} args
23 * @returns
24 */
25 const triggerEvent = (element, eventName, args = {}) => {
26 const evt = new CustomEvent(eventName, {
27 bubbles: true,
28 cancelable: true,
29 detail: args,
30 });
31
32 element.dispatchEvent(evt);
33
34 return evt;
35 };
36
37 // Expose helper methods
38 exposeHelper({
39 EVENTS,
40 triggerEvent,
41 });
42
43 export { EVENTS, triggerEvent };
44