All Projects β†’ briancavalier β†’ most-behave

briancavalier / most-behave

Licence: MIT license
Experimental continuous Behaviors for most.js

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to most-behave

purescript-pop
πŸ˜ƒ A functional reactive programming (FRP) demo created with PureScript events and behaviors.
Stars: ✭ 33 (+3.13%)
Mutual labels:  reactive-programming, functional-reactive-programming
Reactiveui
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
Stars: ✭ 6,709 (+20865.63%)
Mutual labels:  reactive-programming, functional-reactive-programming
fpEs
Functional Programming for EcmaScript(Javascript)
Stars: ✭ 40 (+25%)
Mutual labels:  reactive-programming, functional-reactive-programming
WhatFilm
Simple iOS app using TMDb API and RxSwift
Stars: ✭ 35 (+9.38%)
Mutual labels:  reactive-programming, functional-reactive-programming
Rerxswift
ReRxSwift: RxSwift bindings for ReSwift
Stars: ✭ 97 (+203.13%)
Mutual labels:  reactive-programming, functional-reactive-programming
ObservableComputations
Cross-platform .NET library for computations whose arguments and results are objects that implement INotifyPropertyChanged and INotifyCollectionChanged (ObservableCollection) interfaces.
Stars: ✭ 94 (+193.75%)
Mutual labels:  reactive-programming, functional-reactive-programming
Lpdmvvmkit
LPDMvvmKit - Elegant MVVM framework in Objective-C.
Stars: ✭ 400 (+1150%)
Mutual labels:  reactive-programming, functional-reactive-programming
assembler
Functional, type-safe, stateless reactive Java API for efficient implementation of the API Composition Pattern for querying/merging data from multiple datasources/services, with a specific focus on solving the N + 1 query problem
Stars: ✭ 102 (+218.75%)
Mutual labels:  reactive-programming, functional-reactive-programming
Spring 5 Examples
This repository is contains spring-boot 2 / spring framework 5 project examples. Using reactive programming model / paradigm and Kotlin
Stars: ✭ 87 (+171.88%)
Mutual labels:  reactive-programming, functional-reactive-programming
Rocket.jl
Functional reactive programming extensions library for Julia
Stars: ✭ 69 (+115.63%)
Mutual labels:  reactive-programming, functional-reactive-programming
Awesome Rxjs
A collection of awesome RxJS resources
Stars: ✭ 314 (+881.25%)
Mutual labels:  reactive-programming, functional-reactive-programming
Combinerxswiftperformance
A test suite comparing the performance of Combine and RxSwift
Stars: ✭ 154 (+381.25%)
Mutual labels:  reactive-programming, functional-reactive-programming
Cycle State Machine Demo
Non-trivial, real use case demo of a hierarchical state machine library with cyclejs
Stars: ✭ 25 (-21.87%)
Mutual labels:  reactive-programming, functional-reactive-programming
Frp Eventsourcing
Functional Reactive Programming in Event Sourcing Systems
Stars: ✭ 117 (+265.63%)
Mutual labels:  reactive-programming, functional-reactive-programming
Fpgo
Monad, Functional Programming features for Golang
Stars: ✭ 165 (+415.63%)
Mutual labels:  reactive-programming, functional-reactive-programming
awesome-callbags
Callbag Libraries & Learning Material https://github.com/callbag/callbag
Stars: ✭ 85 (+165.63%)
Mutual labels:  reactive-programming
sample-spring-reactive
sample reactive microservices using spring 5, spring boot, spring webflux and project reactor
Stars: ✭ 26 (-18.75%)
Mutual labels:  reactive-programming
reactive-angular-workshop
This is the source code for the world's greatest Reactive Angular Workshop.
Stars: ✭ 30 (-6.25%)
Mutual labels:  reactive-programming
Combine
πŸ»β€β„οΈ Combine 을 곡뢀해 λ΄…μ‹œλ‹€ 🐧
Stars: ✭ 24 (-25%)
Mutual labels:  reactive-programming
springboot2-swagger
Swagger integration with Spring Boot 2.0.1.BUILD-SNAPSHOT and Spring Cloud Finchley.BUILD-SNAPSHOT
Stars: ✭ 17 (-46.87%)
Mutual labels:  reactive-programming

Behavior

EXPERIMENTAL Don't use this for anything real ... yet.

Continuous time-varying values for most.js. Behaviors are the continuous complement to most.js discrete Event Streams, or, if you prefer, the "pull" complement to most.js "push" Event Streams.

Try it

Feedback welcome via gitter, but seriously, don't use it for anything real yet.

npm i --save @briancavalier/most-behavior

Behavior

A Behavior is a continuous value. In contrast to an Event Stream which has discrete occurrences at particular instants in time, a Behavior's value is defined at all real number (not integer) values of time and may vary continuously (or not) over time.

Because they are defined for all real number values of time, a Behavior must be sampled to obtain its value at specific instants in time. To sample a Behavior, pass it an Event Stream whose occurrences define all the points in time at which the behavior's value should be sampled.

Here's a simple example. Note that because clock is "pull", it does no work at the instants between clicks, where it is not being sampled.

import { time } from '@briancavalier/most-behavior'
import { click } from '@most/dom-event'

// A Behavior that always represents milliseconds since the application started
const clock = time

// Sample the clock each time the user clicks
const timeAtEachClick = sample(clock, click(document))

For now, see the examples dir for more realistic code, how to run a @most/core app that integrates behaviors, etc.

API

Creating Behaviors

time :: Behavior number

A behavior that represents the current time in milliseconds since the application started.

always :: a β†’ Behavior a

Create a Behavior whose value is always a.

step :: a β†’ Stream a β†’ Behavior a

Create a Behavior that starts with an initial value and updates to each new value in the Event Stream.

Transforming Behaviors

map :: (a β†’ b) β†’ Behavior a β†’ Behavior b

Apply a function to a Behavior at all points in time.

apply :: Behavior (a β†’ b) β†’ Behavior a β†’ Behavior b

Apply a (time-varying) function to a Behavior at all points in time.

liftA2 :: (a β†’ b β†’ c) β†’ Behavior a β†’ Behavior b β†’ Behavior c

Apply a function to 2 Behaviors at all points in time.

Sampling Behaviors

sample :: Behavior a β†’ Stream b β†’ Stream a

Sample a Behavior's value at every occurrence of an Event Stream.

snapshot :: Behavior a β†’ Stream b β†’ Stream [a, b]

Sample a Behavior at every occurrence of an event, and compute a new event from the (event, sample) pair.

Potential APIs

Potentially useful APIs we could add:

when :: Behavior bool β†’ Stream a β†’ Stream a

Allow events only when a Behavior's value is true.

accum :: a β†’ Stream (a β†’ a) β†’ Behavior a

Create a Behavior with an initial value and an Event Stream carrying update functions.

scanB :: (a β†’ b β†’ a) β†’ a β†’ Stream b β†’ Behavior a

Like scan, but produces a Behavior. Needs a helpful name ...

scanB :: (a β†’ b β†’ Behavior a) β†’ Behavior a β†’ Stream b β†’ Behavior b

Generalized scan for Behaviors. When event occurs, sample Behavior, and apply a function that creates a new Behavior. Somewhat like switch. Needs a helpful name ...

count :: Stream a β†’ Behavior number

Create a Behavior representing the number of event occurrences.

switch :: Behavior a β†’ Stream (Behavior a) β†’ Behavior a

Create a Behavior that acts like an initial Behavior and switches to act like each new Behavior that occurs in the Event Stream.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].