Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support for context-free property subscribers #129

Merged
merged 9 commits into from
Jan 12, 2024

Conversation

jlacivita
Copy link
Contributor

@jlacivita jlacivita commented Aug 24, 2023

Allows a subscriber to be registered for all events, regardless of context parameter value.

For a property with a context parameter, e.g.:

const value = await Module.property(context)

if the x-subscriber-type is set to global in the OpenRPC, then the notification for the property will have no parameters except for the callback:

Module.property( (info) => {
console.dir(info)
})

The info parameter of the callback will have one property for each parameter, and one additional property for the result, based on the param or result's name attribute in the OpenRPC e.g.:

{
  "context": "the value of the context parameter for this notification",
  "result": "the value of the result for this notification"
}

if there is a parameter with the same name as the result, then the value of that property will be the value of the result.

@jlacivita jlacivita merged commit d4a1c6e into next Jan 12, 2024
6 checks passed
@kschrief
Copy link
Contributor

🎉 This PR is included in version 2.3.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kschrief
Copy link
Contributor

kschrief commented Feb 8, 2024

🎉 This PR is included in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants