This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.cacheset = function(owner, datarequest, object) { | |
// assigns object to webkitcache | |
YUI().use('cache', function(Y) { | |
if (!webkit.wkcache) { | |
webkit.wkcache = new Y.Cache({max:10}); | |
} | |
if (webkit.Y.one('#' + object)) { | |
YUI().log('set cache based on domID'); | |
// part of DOM, create clone | |
webkit.wkcache.add(owner + '_' + datarequest, webkit.Y.one('#' + object).cloneNode(true)); | |
} | |
else { | |
YUI().log('set cache based on object for ' + owner + ' ' + datarequest + ': ' + object); | |
webkit.wkcache.add(owner + '_' + datarequest, object); | |
} | |
}) | |
} | |
this.cacheget = function(owner, datarequest) { | |
// checks to see if cache for datarequest exists | |
if (webkit.wkcache && webkit.wkcache.retrieve(owner + '_' + datarequest)) { | |
return true; | |
} | |
return false; | |
} | |
this.cacheoutput = function(owner, datarequest, object) { | |
YUI().use('cache', function(Y) { | |
if (webkit.Y.one('#' + object)) { | |
YUI().log('replace node in DOM'); | |
// replace entire object with cached object | |
webkit.Y.one('#' + object).replace(webkit.wkcache.retrieve(owner + '_' + datarequest)); | |
} | |
else { | |
YUI().log('replace object of ' + owner + ' ' + datarequest + ': ' + webkit.wkcache.retrieve(owner + '_' + datarequest)); | |
var thisobj = webkit.wkcache.retrieve(owner + '_' + datarequest); | |
// updating using cache contents | |
object = webkit.wkcache.retrieve(owner + '_' + datarequest); | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment