Update bonfire plugin version number to force fresh import on browsers
This commit is contained in:
81
public/js/lib/bonfire/plugin_v0.1.4.js
Normal file
81
public/js/lib/bonfire/plugin_v0.1.4.js
Normal file
@@ -0,0 +1,81 @@
|
||||
|
||||
// executes the given code and handles the result
|
||||
var run = function(code) {
|
||||
var result = {
|
||||
input: code,
|
||||
output: null,
|
||||
error: null,
|
||||
type: null
|
||||
};
|
||||
|
||||
try {
|
||||
var codeExec = runHidden(code);
|
||||
result.type = typeof codeExec;
|
||||
result.output = stringify(codeExec);
|
||||
} catch(e) {
|
||||
result.error = e.message;
|
||||
}
|
||||
|
||||
application.remote.output(result);
|
||||
};
|
||||
|
||||
|
||||
// protects even the worker scope from being accessed
|
||||
var runHidden = function(code) {
|
||||
|
||||
var importScript = function(url) {
|
||||
var error = null;
|
||||
try {
|
||||
importScripts(url);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
console.log('Unable to load ramda!');
|
||||
}
|
||||
};
|
||||
var indexedDB = null;
|
||||
var location = null;
|
||||
var navigator = null;
|
||||
var onerror = null;
|
||||
var onmessage = null;
|
||||
var performance = null;
|
||||
var self = null;
|
||||
var webkitIndexedDB = null;
|
||||
var postMessage = null;
|
||||
var close = null;
|
||||
var openDatabase = null;
|
||||
var openDatabaseSync = null;
|
||||
var webkitRequestFileSystem = null;
|
||||
var webkitRequestFileSystemSync = null;
|
||||
var webkitResolveLocalFileSystemSyncURL = null;
|
||||
var webkitResolveLocalFileSystemURL = null;
|
||||
var addEventListener = null;
|
||||
var dispatchEvent = null;
|
||||
var removeEventListener = null;
|
||||
var dump = null;
|
||||
var onoffline = null;
|
||||
var ononline = null;
|
||||
importScript("https://cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js");
|
||||
var _ = R;
|
||||
|
||||
|
||||
return eval(code);
|
||||
}
|
||||
|
||||
|
||||
// converts the output into a string
|
||||
var stringify = function(output) {
|
||||
var result;
|
||||
|
||||
if (typeof output == 'undefined') {
|
||||
result = 'undefined';
|
||||
} else if (output === null) {
|
||||
result = 'null';
|
||||
} else {
|
||||
result = JSON.stringify(output) || output.toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
application.setInterface({run:run});
|
Reference in New Issue
Block a user