Comments (4)
This sounds like a nice simplification.
from effection.
The one difficulty is that it is annoying to have to save the back reference to Subscription when creating it by hand:
let subscription = {
*next() {
// implement next
},
*[Symbol.iterator]() { return subscription; },
};
return subscription;
Perhaps we can make a helper "createSubscription()" that helps you do it my just accepting the content of next:
createSubscription(function* next() {
// implementation of next operation.
});
So for example, the implementation of Subscription in Channel would be something like:
subscription: createSubscription(function* next() {
let message = items.pop();
if (message) {
return message;
} else {
return yield* action<Item>(function* (resolve) {
consumers.unshift(resolve);
});
}
}),
Thus far, it has been extremely rare to create subscriptions by hand, since most of the time, I just end up using Channel
for lower level ops.
from effection.
I'm going to advocate that we first disambiguate streams from subscriptions (you should never need to deal with a subscription directly) and then we can add make subscriptions streamable individually which will be possible if they have separate API.
from effection.
Closed by #696
from effection.
Related Issues (20)
- Update @effection/fetch to depend on `cross-fetch ^3.1.5`
- Future<T> type improvements HOT 2
- Use `name` label in effection stack trace
- Typo in collections documentation HOT 2
- How production-ready Effection is? HOT 2
- Include a portion of process output in a failed `process.expect()` HOT 2
- Exception has occurred: Error: halted HOT 5
- Adding Effection backtrace to `DOMException` results in an error that cannot be read HOT 1
- Add `iterate()` helper to drive stream iteration that is fully integrated with program structure. HOT 1
- Composable stream combinators HOT 1
- Update v3 docs to have feature parity with v2 docs
- implement `ensure()` for v3 HOT 1
- Power Scopes
- Rename `Channel.input` -> `Channel.port`, `Channel.output` -> `Channel.stream` HOT 1
- Why generators and not async/await for default syntax? HOT 7
- Scope simplification
- Add `createSignal` function for dispatching events from outside effection HOT 1
- Current documentation is broken (non-navigable) HOT 2
- Plan for Migrating Effection Documentation from v2 -> v3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from effection.