0.0.9 • Published 6 years ago

use-stream-state v0.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

use-stream-state

React-hooks with RXjs

Demo

  • check is online - link
const useOnline = () => {
  const [isOnline] = useStreamState(true, () =>
    merge(
      fromEvent(window, "online").pipe(mapTo(true)),
      fromEvent(window, "offline").pipe(mapTo(false))
    ).pipe(
      startWith(window.navigator.onLine),
      share()
    )
  );
  return isOnline;
}
0.0.9

6 years ago

0.0.8

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago