diff options
author | suVene | 2008-12-06 18:51:26 +0000 |
---|---|---|
committer | suVene | 2008-12-06 18:51:26 +0000 |
commit | 90723baa596d15b60f8e7d58fe14c12c47bfc728 (patch) | |
tree | 2d76664bcfbadb991b7a0d205804d243ad55ad30 /notifier/subject_test.js | |
parent | f417812b520e599923e346715dc455021db1ceff (diff) | |
download | vimperator-plugins-90723baa596d15b60f8e7d58fe14c12c47bfc728.tar.bz2 |
変更通知framework.& それを利用したGrowl風plugin(途中)
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26017 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'notifier/subject_test.js')
-rw-r--r-- | notifier/subject_test.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/notifier/subject_test.js b/notifier/subject_test.js new file mode 100644 index 0000000..b5689c6 --- /dev/null +++ b/notifier/subject_test.js @@ -0,0 +1,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: + |