@yuneta/gobj-js 7.25.8 → 7.25.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -318,6 +318,23 @@ gobj_subscribe_event(pub, "EV_X", {__filter__: {v: 1}}, sub_c); // gets the
318
318
  gobj_publish_event(pub, "EV_X", {v: 1, secret: "s"}); // the kw stays {v: 1, secret: "s"}
319
319
  ```
320
320
 
321
+ **A renamed event** (since 7.25.9, the same rule as the C kernel):
322
+ `{__config__: {__rename_event_name__: "EV_A"}}` sends the subscriber `EV_A`
323
+ instead of the published event, with `__original_event_name__` in the kw, when
324
+ some gclass declares `EV_A` (a rename nobody declares is logged and ignored).
325
+ The rename is part of what the subscription IS: a renamed subscription over a
326
+ plain one is a second one, while a plain kw is a wildcard, so a plain
327
+ subscription over a renamed one replaces it and a plain unsubscribe removes
328
+ both.
329
+
330
+ ```javascript
331
+ gobj_subscribe_event(pub, "EV_ON_MESSAGE", {}, sub); // one
332
+ gobj_subscribe_event(pub, "EV_ON_MESSAGE",
333
+ {__config__: {__rename_event_name__: "EV_A"}}, sub); // two
334
+ gobj_publish_event(pub, "EV_ON_MESSAGE", {}); // sub gets EV_ON_MESSAGE, and EV_A
335
+ gobj_unsubscribe_event(pub, "EV_ON_MESSAGE", {}, sub); // none
336
+ ```
337
+
321
338
  ### GObject Tree (Yuno)
322
339
 
323
340
  GObjects form a parent-child tree. The root is the **Yuno**. Services live directly under the Yuno. Each GObject has exactly one parent (except the Yuno itself).