This post presents an example
using HTML5 Web Workers.
The Web Workers are very
similar to the Agent based computation presented in previous posts:
·
Agent based
example using F# MailboxProcessor
·
Real-time
Computation Engine with F#
Example:
This example use one HTML5 main page and one Web Worker.
The example consists of two parts:
1.
Non-state-based request/reply messages to the
Web Worker:
Sum: send a message with two values and
receive back the sum of them
2.
State-based interaction with the Web Worker:
Check State: receives from the Web Worker
its state (idle, active)
Go to Active: starts in the Web Worker a
periodic procedure every 15 sec that generate two random numbers and keeps an
accumulation of them
Clear Accumulation
Go to Idle: stops the periodic procedure in
the Web Worker
Check the full article at:
https://skydrive.live.com/?cid=BDC87EF39B001785&id=BDC87EF39B001785%21110#!/view.aspx?cid=BDC87EF39B001785&resid=BDC87EF39B001785%21730
No comments:
Post a Comment