Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

cas de test qui pete + debut de doc

  • Loading branch information...
commit 16fff2fee305e068f6e68bdd6d25c7fd75b7d06a 1 parent d2319c3
jto authored

Showing 2 changed files with 54 additions and 0 deletions. Show diff stats Hide diff stats

  1. +45 0 README.md
  2. +9 0 test.html
45 README.md
Source Rendered
... ... @@ -0,0 +1,45 @@
  1 +# procratination.js
  2 +
  3 +## What is it?
  4 +
  5 +procratination.js makes it easy to create realtime web applications using pure Javascript,
  6 +by replacing the old callback paradigm, by a stream of events called a Reactive.
  7 +You're not working on discrete events anymore, but with a continuous, possibly infinite, list of incoming data of any kind.
  8 +Reactives have the traditionnal list methods that you are used to, like filter and map, are immutable, and reusable.
  9 +
  10 +## Reactive
  11 +
  12 +### Creating a Reactive
  13 +
  14 +Let's say you want to react on keyboard events. What you first need to do, is to create a function that is your Events source:
  15 +
  16 +<code>
  17 + function key(next){ $(document.body).keydown(next) }
  18 +</code>
  19 +
  20 +<code>next</code> is a the function that should be called when an new event is raised.
  21 +
  22 +Then you need to create a new Reactive,
  23 +<code>
  24 + Reactive.on(key)
  25 +</code>
  26 +
  27 +A Reactive won't do anything until call 'subscribe' on it.
  28 +
  29 +<code>
  30 + Reactive.on(key)
  31 + .subscribe()
  32 +</code>
  33 +
  34 +We now have created our very first reactive :)
  35 +This one does not do anything, we'll now take a look at Actions.
  36 +
  37 +## Action
  38 +
  39 +Let's start with our first reactive:
  40 +<code>
  41 + Reactive.on(key)
  42 + .subscribe()
  43 +</code>
  44 +
  45 +
9 test.html
@@ -33,6 +33,14 @@
33 33 console.log('-- %o', v)
34 34 next(v)
35 35 })
  36 +
  37 + var r3 = Reactive
  38 + .on(key)
  39 + .group(3)
  40 + .await(log)
  41 +
  42 + r3.subscribe()
  43 + r3.subscribe()
36 44
37 45 var aa = Reactive.on(key),
38 46 ab = Reactive.on(mousemove)
@@ -48,6 +56,7 @@
48 56 })
49 57
50 58 Reactive.on(key)
  59 + .on(click)
51 60 .map(function(evt){
52 61 return evt.keyCode
53 62 })

0 comments on commit 16fff2f

Please sign in to comment.
Something went wrong with that request. Please try again.