borismus / game-asset-loader Goto Github PK
View Code? Open in Web Editor NEWHTML5 Filesystem, offline capable loader for web game assets.
Home Page: http://smus.com/game-asset-loader
License: Apache License 2.0
HTML5 Filesystem, offline capable loader for web game assets.
Home Page: http://smus.com/game-asset-loader
License: Apache License 2.0
Hi, I modified gal.filesystem.js to replace BlobBuilder with Blob (BlobBuilder doesn't work for chrome v24). Below is the modified code:
GALFS.prototype.saveAsset = function(key, url, callback, failCallback) {
// BlobBuilder shim
// var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;
var root = this.root;
var lookupTable = this.lookupTable;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.addEventListener('load', function() {
createDir_(root, dirname_(key).split('/'), function(dir) {
dir.getFile(basename_(key), {create: true}, function(fileEntry) {
fileEntry.createWriter(function(writer) {
writer.onwrite = function(e) {
// Save this file in the path to URL lookup table.
lookupTable[key] = fileEntry.toURL();
callback();
};
writer.onerror = failCallback;
// var bb = new BlobBuilder();
var blob = new Blob([xhr.response], {type: ''});
// bb.append(xhr.response);
writer.write(blob);
// writer.write(bb.getBlob());
}, failCallback);
}, failCallback);
});
});
xhr.addEventListener('error', failCallback);
xhr.send();
};
Now this works and the files are downloaded correctly but the onProgress function is not firing and the onLoaded function seems to fire only sometimes.. any insights?
When I run the examples on Firefox and Chrome I get this error :
storageInfo is undefined
On the file gal.filesystem.js
Line number122
// Get quota
storageInfo.requestQuota(window.PERSISTENT, quota,
quotaCallback, onError);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.