Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

malte (1708)

malte
  (email not shown publicly)
http://www.yur.tv/

Perl hacker for this [schaffhausen.de] company. My Dad's Practice [praxisamhogenkamp.de]

Journal of malte (1708)

Friday March 21, 2008
02:34 PM

Google Gears support in Joose

[ #35952 ]
You can now automatically execute methods of a Joose.Class in a different thread using Google Gears. All you need to do is use the meta class Joose.Gears and add a worker method. All the Gears-Interfacing is handled for you. If Gears is not present, the worker is executed in the main thread. The workers result will be sent to a method called "on".ucfirst($worker_name) if available:

Class("HardWork", {
    meta: Joose.Gears,
    has: {
        data: {is: rw, init: {}}
    },
    methods: {
        onDoWork: function (result) {
            ok(result == 1001, "Gear Worker returns correct result")
        }
    },
    workers: {
        doWork: function (start) {
            var counter = start;
            for(var i = 0; i < 1000; i++) {
                counter++
            }
            return counter
        }
    }
})

var hw = new HardWork();

hw.doWork(1)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.