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

low: stoppable in view #40

Closed
betula opened this issue Mar 16, 2021 · 1 comment
Closed

low: stoppable in view #40

betula opened this issue Mar 16, 2021 · 1 comment

Comments

@betula
Copy link
Member

betula commented Mar 16, 2021

const v = value(0);
const positive_v = v.view((n) => n >= 0 ? n : stoppable().stop()); // Add stop method to stop signal. (Make external stop siglal interface)

on(positive_v, console.log) // only positive reactions
// but inside value can be any values, and negative too.

// Task: make a positive stream, ignore negative values.

const v = value(0);
const b = value(0);
sync(v, (val) => val >= 0 && b(val));

// what is the method (shortcut) for making it

v.view((dest, val) => val >= 0 && dest(val));

// This is the perfect view.

// or

v.view((val) => val < 0 && stoppable.stop());

// No have reasons for making stoppable in view. Because it will stop only subscribers reaction, but what to be received for direct reading? (undefined)

// That method provide a new entity with the same set of methods.

// But Its only view. Its parts of one entity. Its not a one task.

v.flow((dest, val, prev?) => val >= 0 && dest(val)); // That case is new one.

// That necessary for creating a new entity (signal, value, ready, etc...), from another entity
@betula
Copy link
Member Author

betula commented Mar 16, 2021

Closed with making new task: #41

@betula betula closed this as completed Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant