From 17e603ef270cc86581f1b3c02ee25f5862e07c19 Mon Sep 17 00:00:00 2001
From: suVene
Date: Fri, 26 Dec 2008 13:20:40 +0000
Subject: wedata local cache. etc.
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@27459 d0d07461-0603-4401-acd4-de1884942a52
---
_libly.js | 18 +++++++++++-------
multi_requester.js | 2 +-
nextlink.js | 21 +++++++++------------
3 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/_libly.js b/_libly.js
index 1a3329c..b77b9e5 100644
--- a/_libly.js
+++ b/_libly.js
@@ -523,18 +523,21 @@ libly.Wedata.prototype = {
if (store && store.get('data') && new Date(store.get('expire')) > new Date()) {
logger.log('return cache. ');
- store.get('data').forEach(function(item) itemCallback(item));
- finalCallback(true, store.get('data'));
+ store.get('data').forEach(function(item) { if (typeof itemCallback == 'function') itemCallback(item); });
+ if (typeof finalCallback == 'function')
+ finalCallback(true, store.get('data'));
return;
}
function errDispatcher(msg, cache) {
if (cache) {
logger.log('return cache. -> ' + msg);
- cache.forEach(function(item) itemCallback(item));
- finalCallback(true, cache);
+ cache.forEach(function(item) { if (typeof itemCallback == 'function') itemCallback(item); });
+ if (typeof finalCallback == 'function')
+ finalCallback(true, cache);
} else {
- finalCallback(false, msg);
+ if (typeof finalCallback == 'function')
+ finalCallback(false, msg);
}
}
@@ -553,8 +556,9 @@ libly.Wedata.prototype = {
store.set('expire', new Date(new Date().getTime() + expire).toString());
store.set('data', json);
store.save();
- json.forEach(function(item) itemCallback(item));
- finalCallback(true, json);
+ json.forEach(function(item) { if (typeof itemCallback == 'function') itemCallback(item); });
+ if (typeof finalCallback == 'function')
+ finalCallback(true, json);
}));
req.addEventListener('onFailure', function() errDispatcher('onFailure'));
req.addEventListener('onException', function() errDispatcher('onException') );
diff --git a/multi_requester.js b/multi_requester.js
index 1d4bb51..5016cbf 100644
--- a/multi_requester.js
+++ b/multi_requester.js
@@ -18,7 +18,7 @@ var PLUGIN_INFO =
http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/multi_requester.js
mapping "[[", "]]" by AutoPagerize XPath.
AutoPagerize 用の XPath より "[[", "]]" をマッピングします。
suVene
- 0.2.9
+ 0.2.10
MIT
1.2
2.0pre
http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/nextlink.js