change itemExists to check for the cache, then call _itemExists, that way subclasses can override just that without having to care about the cache

This commit is contained in:
Dan Mills 2008-12-17 02:30:11 -08:00
Родитель 55a9524e8c
Коммит 88e70d14c6
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -97,14 +97,21 @@ Store.prototype = {
fn.async(this, onComplete, record);
},
// override only if neccessary
itemExists: function Store_itemExists(GUID) {
if (GUID in this._lookup)
itemExists: function Store_itemExists(id) {
if (!this._itemCache)
return this._itemExists(id);
if (id in this._itemCache)
return true;
else
return false;
},
// subclasses probably want to override this one
_itemExists: function Store__itemExists(id) {
return false;
},
cacheItemsHint: function Store_cacheItemsHint() {
this._itemCache = this.wrap();
},