GithubHelp home page GithubHelp logo

rx-tapable's Introduction

使用 RxJS 实现 tapable 的功能

⚠️ 该库主要使用了 RxJS 实现了 tapable 的能力,但是行为和原生 tapable 功能有些许的出入

目前实现的功能从直觉上较符合我自己的预期,也是可能符合实际业务预期的实现。 如果对功能需要修改,直接添加或者修改操作符即可。

目前所实现的钩子
  • SeriesHook

所有钩子从上到下依次执行,当所有的函数都执行完毕之后,会调用最后的回调函数。

  • WaterfallHook

所有钩子从上到下以此执行,当所有的函数都执行完毕之后,会调用最后的回调函数。

  • ParallelHook

所有钩子并行执行,当所有的函数都执行完毕之后,会调用最后的回调函数。

通用性说明
  1. tap 函数 仅支持两个参数,第一个参数为名称(暂时未被使用),第二个参数为需要执行的回调函数,该函数只能接收一个参数,在 SeriesHookParallelHook 中,该参数来源于调用 tap 的第一个参数,在 WaterfallHook 中,第一个注册的函数的参数来源于调用 tap 的第一个参数,之后的来源于上一个函数的返回值。
  2. call 函数 仅支持两个参数,第一个参数为传递给 tap 回调函数的参数,第二个为所有 tap 回调函数执行完毕的回调。该函数在 WaterfallHook 中会接收到最后一个 tap 函数注册的返回值,SeriesHookParallelHook 中暂时不接受参数值。

rx-tapable's People

Contributors

xduyhfu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.