GithubHelp home page GithubHelp logo

rxjs-draw's Introduction

RxJS Draw

RxJS Draw is an extension of RxJS observable operator that draws marble diagrams of observables.

This extension is created for learning purpose. It visualizes timeline and output marbles of a subscribed observable to help comprehending how those operators influence your observable. Though it might not be drawn precisely due to the execution and rendering time, still good for an introduction of RxJS.

An unminified RxJS library is required to display the names of chained operators correctly.

Demo

Usage

Include scripts and styles in your page. RxJS 5.0 is used in this version.

<script src="path/to/Rx.js"></script>
<script src="path/to/rxjs-draw.js"></script>
<link rel="stylesheet" href="path/to/rxjs-draw.css">

Add a container of the diagram:

<div id="draw"></div>

Initialize and start drawing your diagram:

// window.rxjsDraw is an instance of RxjsDraw
rxjsDraw.init('#draw');

Rx.Observable
  .interval(1000)
  .take(5)
  .draw('interval take: 5')
  .subscribe();

Browse the result:

demo

API

RxjsDraw.init(selector)

Initialize RxjsDraw by giving a css selector of a diagram container element.

RxjsDraw.stop()

Stop timelines in the diagram from drawing. This method will NOT unsubscribe your subscription of observable.

RxjsDraw.clean()

Remove all contents in the diagram. This method will NOT unsubscribe your subscription of observable.

Observable.draw(name)

The .draw() function is added to Rx.Observable.prototype. name is an unique id for each diagram source.

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.