Skip to content

Commit 551b064

Browse files
[update] add tag and intercept configs into on() and intercept() methods
1 parent 2c5e9b6 commit 551b064

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

docs/api/internal/intercept-method.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@ description: You can learn about the intercept method in the documentation of th
1515
~~~jsx
1616
api.intercept(
1717
event: string,
18-
callback: function
18+
callback: function,
19+
config?: { tag?: number | string | symbol }
1920
): void;
2021
~~~
2122

2223
### Parameters
2324

24-
- `event` - (required) an event to be fired
25+
- `event` - (required) an event to be fired
2526
- `callback` - (required) a callback to be performed (the callback arguments will depend on the event to be fired)
27+
- `config` - (optional) an object that stores the following parameter:
28+
- `tag` - (optional) an action tag. You can use the tag name to remove an action handler via the [`detach`](api/internal/js_kanban_detach_method.md) method
2629

2730
### Events
2831

@@ -59,7 +62,7 @@ const table = new pivot.Pivot("#root", {
5962
//make all rows close at the initialization
6063
table.api.intercept("render-table", (ev) => {
6164
ev.config.data.forEach((row) => (row.open = false));
62-
})
65+
}, {tag: "render-table-tag"});
6366
~~~
6467

6568
**Related articles**: [`render-table`](/api/events/render-table-event)

docs/api/internal/on-method.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ description: You can learn about the on method in the documentation of the DHTML
1515
~~~jsx
1616
api.on(
1717
event: string,
18-
handler: function
18+
handler: function,
19+
config?: { intercept?: boolean, tag?: number | string | symbol }
1920
): void;
2021
~~~
2122

2223
### Parameters
2324

2425
- `event` - (required) an event to be fired
2526
- `handler` - (required) a handler to be attached (the handler arguments will depend on the event to be fired)
27+
- `config` - (optional) an object that stores the following parameters:
28+
- `intercept` - (optional) if you set `intercept: true` during event listener creation, this event listener will run before all others
29+
- `tag` - (optional) an action tag. You can use the tag name to remove an action handler via the [`detach`](api/internal/js_kanban_detach_method.md) method
2630

2731
### Events
2832

@@ -63,5 +67,5 @@ table.api.on("open-filter", (ev) => {
6367
if (field) {
6468
console.log("The field for which filter was activated:", ev.field.label);
6569
}
66-
});
70+
}, {tag: "open-filter-tag"});
6771
~~~

0 commit comments

Comments
 (0)