@10kb/stream 中文文档教程

发布于 4年前 浏览 29 项目主页 更新于 3年前

Build status

Install

npm install 10kb/stream

Purposes

用于简单目的的简单流

Motivation

TODO

Examples

import {Stream} from "../src";

let stream = new Stream()

stream.when((t)=>t=="Hello ").subscribe((text:string)=>{
    console.log(text + "world");
});

stream.notify("Hello ");
stream.notify("Hi ");
//console: Hello world
import {Stream} from "../src";

let stream = new Stream();

let wow = (new Stream()).when((t)=>t=="wow").subscribe((t)=>console.log(`WOW!!`));
let yep = (new Stream()).when((t)=>t=="yep").subscribe((t)=>console.log(`Yep is yep`));

stream.pipe(wow).pipe(yep);

stream.notify("yep");
stream.notify("wow");

//console : Yep is yep
//console : WOW!!

Operators

when(predicate) 独特的(私有的) 映射到(谓词)

Build status

Install

npm install 10kb/stream

Purposes

Simple stream for simple purposes

Motivation

TODO

Examples

import {Stream} from "../src";

let stream = new Stream()

stream.when((t)=>t=="Hello ").subscribe((text:string)=>{
    console.log(text + "world");
});

stream.notify("Hello ");
stream.notify("Hi ");
//console: Hello world
import {Stream} from "../src";

let stream = new Stream();

let wow = (new Stream()).when((t)=>t=="wow").subscribe((t)=>console.log(`WOW!!`));
let yep = (new Stream()).when((t)=>t=="yep").subscribe((t)=>console.log(`Yep is yep`));

stream.pipe(wow).pipe(yep);

stream.notify("yep");
stream.notify("wow");

//console : Yep is yep
//console : WOW!!

Operators

when(predicate) unique(pridicate) mapTo(predicate)

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文