Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better README.md and a makefile

  • Loading branch information...
commit 464e55a74e936d2992081a9549fd4f237232720c 1 parent dbad71e
@jeromeetienne authored
Showing with 49 additions and 3 deletions.
  1. +10 −0 Makefile
  2. +39 −3 README.md
View
10 Makefile
@@ -0,0 +1,10 @@
+# simple makefile to avoid repeatitive tasks
+
+doc_build:
+ docco *.js
+
+doc_monitor: build
+ (while inotifywait -r -e modify,attrib,create . ; do make build; done)
+
+
+
View
42 README.md
@@ -1,5 +1,41 @@
-this is a small library to provide console.* in webworker.
+console4Worker is console.* API for WebWorkers.
-* make it a documentation with the docco ?
-* yep why not
+WebWorkers are hard to debug. On top of that, console.* API is unavailable
+in WebWorkers. It doesn't help. console4Worker tries to fill this gap.
+See the [live demo]. You can find it in the examples/ directory.
+
+
+# how does it work ?
+
+a console.* object is declared in the worker. It intercepts all console.* calls and
+pass them to the page thread. a direct approach.
+
+# page side
+
+To include the script, simply do
+
+ <script src="console4Worker-page.js"></script>
+
+Then in your message event listener, add the following line
+
+ if( console4Worker.filterEvent(event) ) return;
+
+So you should have something like
+
+ worker.addEventListener('message', function(event){
+ // filter this event if it is from console4Worker
+ if( console4Worker.filterEvent(event) ) return;
+
+ // ...
+ // here handle your own events
+
+ }, false);
+
+# worker side
+
+First you include the script with
+
+ importScripts('console4Worker-worker.js');
+
+Then you use console.* as you would normally do
Please sign in to comment.
Something went wrong with that request. Please try again.