Events / Observables
See original GitHub issueI’d be interested in discussing how expected events on observable objects could be described. Here’s a first draft for one possibility based on my understanding of the current structural types:
new Channel({ displayName: String }) => ChannelInstance
interface ChannelInstance {
displayName: String
}, emits: {
messageAdded: { body: String, authorId: Number },
memberJoined: { id: Number }
}
Thoughts?
Issue Analytics
- State:
- Created 8 years ago
- Comments:48 (33 by maintainers)
Top Results From Across the Web
Observables in Angular
Router.events provides events as observables. You can use the filter() operator from RxJS to look for events of interest, and subscribe to them...
Read more >Event shape observables - Wikipedia
In high energy physics, event shapes observables are quantities used to characterize the geometry of the outcome of a collision between high energy ......
Read more >Observable - RxJS
Observables are lazy Push collections of multiple values. ... start an "Observable execution" and deliver values or events to an Observer of that...
Read more >Listen to any DOM Event using an Observable in Angular
An Observable is simply a function that returns a stream of values over time to an observer. Based on this definition, you can...
Read more >Overview - ReactiveX
Observable : represents the idea of an invokable collection of future values or events. Observer: is a collection of callbacks that knows how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tomekwi One of the most important goals for me was to create a standard for documenting APIs that we can use in technical documentation.
We needed a standard, easily machine-readable way to document events, regardless of the listening API.
As for scope creep, I don’t expect early implementations to cover all the features, but event documentation was a must-have feature for me that needed to be in the MVP version. I’m already using it.
This is acceptable to me if everybody else likes it better:
I guess that makes sense if you think of it this way:
messageAdded
is the name of the callback function with the signature(body: String, authorId: Number)
.This fits our existing method syntax:
I’m not sure if we’ve documented it, but IMO, it should be perfectly legal to use quotes and colons with the method syntax, too: