Created
July 11, 2010 22:25
-
-
Save ZhangHanDong/471897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The ParentWorkerPool of Monitor whether the system is online or offline | |
* | |
* Alex([email protected]) | |
* 2009.3 | |
*/ | |
isOnlie: function(){ | |
workerPool = google.gears.factory.create('beta.workerpool'); | |
workerPool.onmessage = function(a, b, message) { | |
if (message.sender == monitorchildWorkerId) { | |
if(message.text == 'online'){ | |
$('#is-connected').show(); | |
$('#is-disconnected').hide(); | |
}else if(message.text == 'offline'){ | |
$('#is-disconnected').show(); | |
$('#is-connected').hide(); | |
} | |
} | |
}; | |
var monitorchildWorkerId = workerPool.createWorkerFromUrl('/javascripts/js_app/models/monitor.js'); | |
workerPool.sendMessage(window.location + '?monitor', monitorchildWorkerId); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment