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: flow method #41

Closed
betula opened this issue Mar 16, 2021 · 6 comments
Closed

low: flow method #41

betula opened this issue Mar 16, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@betula
Copy link
Member

betula commented Mar 16, 2021

// v: signal|value|ready|etc...

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

const v = value(0);
const positive_v = v.flow((positive, n) => n >= 0 && positive(n));

on(positive_v, console.log) // only positive reactions and values

Question: How to make a signal from value?

const s = signal.from(value); // That syntax is perfect!

@betula betula added the enhancement New feature or request label Mar 22, 2021
@betula
Copy link
Member Author

betula commented Mar 27, 2021

Add possibility for use flow with another reactive value

const src = value(0);
const dst = value(0);

src.flow(dst);

@betula
Copy link
Member Author

betula commented Mar 27, 2021

flow.filter added 3eb5a8f

@betula
Copy link
Member Author

betula commented Mar 27, 2021

Extend syntax for flow.filter

class SwipeAnim {

  get process() { return swipeAnimProcess.val; }
  set process(v: boolean) { swipeAnimProcess(v); }


  constructor() {
    swipeBreak.flow.filter(() => this.process);
    // or new syntax
    swipeBreak.flow.filter(swipeAnimProcess);
  }
}

@betula
Copy link
Member Author

betula commented Mar 31, 2021

Extend syntax for flow.filter

export const allReady = ready.from(
  signal.combine(backReady, frontReady)
    .view(([back, front]) => back && front)
    .flow.filter((f) => f) // to -->     .flow.filter()
);

@betula
Copy link
Member Author

betula commented Jun 8, 2021

"filter" and "map" impleneted 0.6.0, "flow" under discussion.

@betula betula closed this as completed Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant