blob: b5689c6cdda313f112cab06b827588ac3c701b88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/**
* notifier.js plugin subject
* @name subject_test.js
* @description notify if ...
* @description-ja ... の時ポップアップ通知。
* @author suVene suvene@zeromemory.info
* @version 0.1.0
* Last Change: 07-Dec-2008.
*/
(function() {
var notifier = liberator.plugins.notifier;
if (!notifier) return;
var lib = notifier.lib;
var $U = lib.$U;
var logger = $U.getLogger('subject_test');
notifier.subject.register({
interval: 3,
initialize: function() {
logger.log('initialize');
this.count = 0;
},
check: function() {
this.count++;
logger.log('check');
var req = new lib.Request(
'http://localhost:8080/index.html',
null, // headers {}
{
encode: 'shift_jis'
}
);
req.addEventListener('onSuccess', $U.bind(this, function(res) {
var text = res.responseText;
logger.log('success!! ');
var message = new notifier.Message('TEST', text);
this.notify(message);
if (this.count == 5) {
notifier.subject.unregister(this);
this.count = 0;
}
}));
req.get();
}
});
})();
// vim: set fdm=marker sw=4 ts=4 sts=0 et:
|