Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 2.36 KB

events.md

File metadata and controls

16 lines (10 loc) · 2.36 KB

Event Handling

https://github.com/RoamJS/roamjs-components/blob/main/src/events

Utilities for setting up and managing event listeners in the Roam Research application are centralized in https://github.com/RoamJS/roamjs-components/blob/main/src/events. The primary function provided is watchOnce, which allows for one-time event listening.

  • watchOnce is designed to monitor changes in a specific Roam Research block and execute a callback function when a change is detected.
  • It takes three parameters: pullPattern (the pattern to watch for), entityId (the block ID to watch), and callback (the function to execute upon detection).

The function operates as follows:

This utility is useful for scenarios where an action needs to be performed once upon a block's update, such as updating a visualization or triggering a notification.