0.2.1 • Published 12 months ago

@reactive-cache/map v0.2.1

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

Reactive Cache

Installation

$ npm install @reactive-cache/core

Usage

import { reactiveCache } from 'reactive-cache';

const data = reactiveCache(fetch('https://...'));

data.subscribe(console.log);

Angular like

import { reactiveCache } from '@reactive-cache/core';
import { ajax } from 'rxjs/ajax';
import { Observable } from "rxjs";

export class FetchDataService {
  public readonly response$ = reactiveCache.valueReadable<unknown>('response$', () => this.fetchData());

  private fetchData(): Observable<unknown> {
    return ajax.get('https://jsonplaceholder.typicode.com/posts');
  }
}

const service = new FetchDataService();
service.data.subscribe(console.log)
console.log(service.data.getValue());
0.2.1

12 months ago

0.2.0

12 months ago

0.1.0

12 months ago

0.0.7

12 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago