-
-
Notifications
You must be signed in to change notification settings - Fork 833
[API] Handler VFS method call consistency #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Update for this is coming later today. There are some other changes coming relating to this coming :) |
👍 Great!. I will concentrate on my backend first. :) |
Hm. I've been working on the VFS today, and now I'm not sure what you're talking about. My OS.js/src/client/javascript/vfs.js Line 200 in f24f5aa
|
it is the following part. All others ('write','exists' etc) use OSjs.VFS.internalCall and use the loaded handler. This one has its own Ajax part that it uses. _NullModule.read = function(item, callback, options) {
options = options || {};
options.onprogress = options.onprogress || function() {};
if ( API.getConfig('Connection.Type') === 'nw' ) {
OSjs.Core.getHandler().nw.request('fs', {
'method': 'read',
'arguments': [
item.path,
{raw: true}
]
}, function(err, res) {
callback(err, res);
});
return;
}
this.url(item, function(error, url) {
if ( error ) {
return callback(error);
}
Utils.ajax({
url: url,
method: 'GET',
responseType: 'arraybuffer',
onprogress: function(ev) {
if ( ev.lengthComputable ) {
options.onprogress(ev, ev.loaded / ev.total);
} else {
options.onprogress(ev, -1);
}
},
onsuccess: function(response, xhr) {
if ( !xhr || xhr.status === 404 || xhr.status === 500 ) {
callback(xhr.statusText || response);
return;
}
callback(false, response);
},
onerror: function(error) {
callback(error);
}
});
});
}; |
I see you moved some files. It is now in internal.js on line 93 |
I just made some changed to properly name and split some sections. Functionality has not changed :)
That's because I use a XHR request that returns I can make it possible to customize this as well. Just have to think it out first. |
If the 'write' goes through the handler i think the read should do the same. The handler could return an ArrayBuffer as well. |
This was added to the branch https://github.com/os-js/OS.js/tree/new-api-uris. https://github.com/os-js/OS.js/blob/new-api-uris/src/client/javascript/handler.js#L341 You can now hook into them all:
|
I might change the name from |
Ok. So now the handler has these:
That should cover everything :) |
Maybe even split _callAPI into _callAPI and _callVFS. Then everything has its own. |
|
Superseeded by #304 |
At the moment _NullModule.read (in src\client\javascript\vfs_null.js) is the only function that does not use the handler that is returned by OSjs.Core.getHandler(). I see that the .write has been changed to use the handler.
Would it not be possible to make a OSjs.VFS.internalCall so that i can process this in my custom handler?
The text was updated successfully, but these errors were encountered: