fix a bug related to clearing the requests cache

This commit is contained in:
rlx 2011-10-29 12:32:55 +00:00
parent 45ad8ee468
commit 7415b72037
3 changed files with 23 additions and 13 deletions

View file

@ -119,8 +119,9 @@ Ox.Request = function(options) {
options.age == -1 options.age == -1
|| options.age > +new Date() - cache[req].time || options.age > +new Date() - cache[req].time
)) { )) {
var data = cache[req].data;
setTimeout(function() { setTimeout(function() {
callback && callback(cache[req].data); callback && callback(data);
}, 0); }, 0);
} else { } else {
pending[options.id] = true; pending[options.id] = true;

View file

@ -695,7 +695,6 @@ Ox.Input = function(options, self) {
newValue = oldValue.substr(0, oldCursor[0] - 1), newValue = oldValue.substr(0, oldCursor[0] - 1),
hasDeletedSelectedEnd = (event.keyCode == 8 || event.keyCode == 46) && hasDeletedSelectedEnd = (event.keyCode == 8 || event.keyCode == 46) &&
oldCursor[0] < oldCursor[1] && oldCursor[1] == oldValue.length; oldCursor[0] < oldCursor[1] && oldCursor[1] == oldValue.length;
Ox.print('CHANGE ON KEYPRESS', self.options.changeOnKeypress);
if ( if (
event.keyCode != 9 // tab event.keyCode != 9 // tab
&& (self.options.type == 'textarea' || event.keyCode != 13) // enter && (self.options.type == 'textarea' || event.keyCode != 13) // enter

View file

@ -122,20 +122,30 @@ Ox.load = function() {
}; };
Ox.Log = (function() { Ox.Log = (function() {
var filter = /*localStorage && localStorage.filter var filter = localStorage && localStorage.filter
? new RegExp(localStorage.filter) || */'/.*?/', ? JSON.parse(localStorage.filter) : 0,
that = function() { that = function() {
Ox.Log.log.apply(null, arguments); return that.log.apply(null, arguments);
return that;
}; };
that.filter = function(regexp) { that.filter = function(value) {
filter = regexp; filter = value;
// ... if (localStorage) {
}; localStorage.filter = JSON.stringify(filter);
that.log = function() {
if (filter.test(JSON.stringify(arguments))) {
Ox.print.apply(null, arguments);
} }
return that;
};
that.log = function log() {
var args = Ox.makeArray(arguments),
level = Ox.isNumber(args[0]) ? args[0] : 0,
ret;
if ((Ox.isNumber(filter) && level >= filter) || filter === args[0]) {
args.unshift(
(arguments.callee.caller && arguments.callee.caller.name)
|| '(anonymous)'
);
ret = Ox.print.apply(null, args);
}
return ret;
}; };
return that; return that;
}()); }());