File: examples/demo2.html

Recommend this page to a friend!
  Classes of Thomas Björk   JS and CSS Resource Loader   examples/demo2.html   Download  
File: examples/demo2.html
Role: Example script
Content type: text/plain
Description: Documentation
Class: JS and CSS Resource Loader
Load cached JavaScript and CSS from localStorage
Author: By
Last change: Added sessionStorage as a cache engine
Added options.loadedFrom
Changed the options.cache to only be used to indicate if the cache should be used or not. The name of the cache key is moved to options.cacheName
Added options as an argument to the options.complete callback and the options.test callback
Updated the readme
Date: 2 years ago
Size: 625 bytes


Class file image Download
<!DOCTYPE html> <html lang="en"> <head> <title>Simple demo</title> <script src="../resourceloader.js"></script> <script> var options = { cache: true, cacheTimeout: 7200, complete: function(options) { alert("Loaded "+options.src+" from "+options.loadedFrom); }, test: function(options) { if(typeof(dummyObject) != "undefined") { return true; } return false; } } window.resourceLoader.load("dummies/script1.js", options); window.resourceLoader.load("dummies/script1.js", options); </script> </head> <body> </body> </html>