We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a250aa7 commit 5595935Copy full SHA for 5595935
inst/htmlwidgets/anyhtmlwidget.js
@@ -1,11 +1,21 @@
1
class CallbackRegistry {
2
+ /** @type {Record<string, Function[]>} */
3
#callbacks = {};
4
+ /**
5
+ * @param {string} name
6
+ * @param {Function} callback
7
+ */
8
add(name, callback) {
9
if (!this.#callbacks[name]) {
10
this.#callbacks[name] = [];
11
}
12
this.#callbacks[name].push(callback);
13
14
15
16
+ * @param {Function} [callback] - a specific callback to remove
17
+ * @returns {Function[]} - the removed callbacks
18
19
remove(name, callback) {
20
21
return [];
0 commit comments