Sha256: 0c92102314722e4e1960bf170dc83d189a9f9d52ae728e9a36b5d0243b6855aa
Contents?: true
Size: 1.72 KB
Versions: 8
Compression:
Stored size: 1.72 KB
Contents
rio.File = { open: function(path, options) { var file; var asynchronous = (options.asynchronous != undefined ? options.asynchronous : true); new Ajax.Request(rio.url(path), { asynchronous: asynchronous, method: "get", evalJSON: false, evalJS: false, onSuccess: function(response) { file = response.responseText; (options.onSuccess || Prototype.emptyFunction)(file); }, onFailure: function() { if(options.onFailure) { options.onFailure(); } else { rio.Application.fail("Failed loading file: " + path); } } }); if (!asynchronous) { return file; } }, json: function(path, options) { new Ajax.Request(rio.url(path), { asynchronous: true, method: "get", evalJSON: true, evalJS: false, onSuccess: function(response) { options.onSuccess(response.responseJSON); }, onFailure: function() { rio.Application.fail("Failed loading file: " + path); } }); }, execute: function(path, options) { new Ajax.Request(rio.url(path), { asynchronous: (options.asynchronous != undefined ? options.asynchronous : true), method: "get", evalJSON: false, evalJS: true, onSuccess: function(response) { }, onFailure: function() { rio.Application.fail("Failed loading file: " + path); } }); }, write: function(path, content, options) { new Ajax.Request("/rio/file", { asynchronous: (options.asynchronous != undefined ? options.asynchronous : true), method: "post", evalJSON: false, evalJS: false, parameters: { path: path, content: content }, onSuccess: function(response) { options.onSuccess(response); }, onFailure: function() { rio.Application.fail("Failed writing file: " + path); } }); } };
Version data entries
8 entries across 8 versions & 1 rubygems