Skip to content

Commit

Permalink
created fibWW finished example, added instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
ntschutta committed Nov 24, 2011
1 parent 12f295c commit 759aa7c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions javascript/fibWW_finished.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
onmessage = callFib;

function callFib(event) {
var input = event.data;
var result = fib(input);
postMessage(result);
}

function fib(n) {
var s = 0;
if(n == 0) return(s);
if(n == 1) {
s += 1;
return(s);
} else {
return(fib(n - 1) + fib(n - 2));
}
}
6 changes: 6 additions & 0 deletions labs_instructions/web_worker.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Web Worker

* Implement calculateFibWW
* Convert fibWW.js to be a web worker
* Use a web worker to call fibWW.js
* ${extract}/html5_workshop/labs/web_worker.html

0 comments on commit 759aa7c

Please sign in to comment.