Commit c66af27e authored by Alex Beregszaszi's avatar Alex Beregszaszi

Standard: format whitespace (using semistandard-format)

parent 18f094d7
......@@ -22,9 +22,9 @@
* THE SOFTWARE.
*/
var multi = function(func) { return func.toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; }
var multi = function (func) { return func.toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; };
var BALLOT_EXAMPLE = multi(function(){/*contract Ballot {
var BALLOT_EXAMPLE = multi(function () { /*contract Ballot {
struct Voter {
uint weight;
......
/* global chrome */
chrome.browserAction.onClicked.addListener(function (tab) {
chrome.storage.sync.set({ 'chrome-app-sync': true });
chrome.storage.sync.set({ 'chrome-app-sync' : true });
chrome.tabs.create({ 'url': chrome.extension.getURL('index.html') }, function (tab) {
chrome.tabs.create({ 'url': chrome.extension.getURL('index.html') }, function (tab) {
// tab opened
});
});
});
This diff is collapsed.
var version = function() { return '(loading)'; }
var compileJSON = function() { return ''; }
var version = function () { return '(loading)'; };
var compileJSON = function () { return ''; };
var missingInputs = [];
module.exports = function (self) {
self.addEventListener('message', function(e) {
var data = e.data;
switch (data.cmd) {
case 'loadVersion':
delete Module;
version = null;
compileJSON = null;
self.addEventListener('message', function (e) {
var data = e.data;
switch (data.cmd) {
case 'loadVersion':
delete Module;
version = null;
compileJSON = null;
importScripts(data.data);
version = Module.cwrap("version", "string", []);
if ('_compileJSONCallback' in Module)
{
var compileJSONInternal = Module.cwrap("compileJSONCallback", "string", ["string", "number", "number"]);
var missingInputCallback = Module.Runtime.addFunction(function(path) {
missingInputs.push(Module.Pointer_stringify(path));
});
compileJSON = function(input, optimize) {
return compileJSONInternal(input, optimize, missingInputCallback);
};
}
else if ('_compileJSONMulti' in Module)
compileJSON = Module.cwrap("compileJSONMulti", "string", ["string", "number"]);
else
compileJSON = Module.cwrap("compileJSON", "string", ["string", "number"]);
postMessage({
cmd: 'versionLoaded',
data: version(),
acceptsMultipleFiles: ('_compileJSONMulti' in Module)
});
break;
case 'compile':
missingInputs.length = 0;
postMessage({cmd: 'compiled', data: compileJSON(data.source, data.optimize), missingInputs: missingInputs});
break;
}
}, false);
}
importScripts(data.data);
version = Module.cwrap("version", "string", []);
if ('_compileJSONCallback' in Module)
{
var compileJSONInternal = Module.cwrap("compileJSONCallback", "string", ["string", "number", "number"]);
var missingInputCallback = Module.Runtime.addFunction(function (path) {
missingInputs.push(Module.Pointer_stringify(path));
});
compileJSON = function (input, optimize) {
return compileJSONInternal(input, optimize, missingInputCallback);
};
}
else if ('_compileJSONMulti' in Module)
compileJSON = Module.cwrap("compileJSONMulti", "string", ["string", "number"]);
else
compileJSON = Module.cwrap("compileJSON", "string", ["string", "number"]);
postMessage({
cmd: 'versionLoaded',
data: version(),
acceptsMultipleFiles: ('_compileJSONMulti' in Module)
});
break;
case 'compile':
missingInputs.length = 0;
postMessage({cmd: 'compiled', data: compileJSON(data.source, data.optimize), missingInputs: missingInputs});
break;
}
}, false);
};
......@@ -42,7 +42,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
sourceAnnotations = [];
outputField.empty();
var input = editor.getValue();
editor.setCacheFileContent(input)
editor.setCacheFileContent(input);
var files = {};
files[editor.getCacheFile()] = input;
......@@ -148,7 +148,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
function loadInternal (url, setVersionText) {
Module = null;
// Set a safe fallback until the new one is loaded
compileJSON = function(source, optimize) { compilationFinished('{}'); };
compileJSON = function (source, optimize) { compilationFinished('{}'); };
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
......@@ -171,14 +171,14 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
worker.addEventListener('message', function (msg) {
var data = msg.data;
switch (data.cmd) {
case 'versionLoaded':
compilerAcceptsMultipleFiles = !!data.acceptsMultipleFiles;
onCompilerLoaded(setVersionText, data.data);
break;
case 'compiled':
compilationFinished(data.data, data.missingInputs);
break;
};
case 'versionLoaded':
compilerAcceptsMultipleFiles = !!data.acceptsMultipleFiles;
onCompilerLoaded(setVersionText, data.data);
break;
case 'compiled':
compilationFinished(data.data, data.missingInputs);
break;
}
});
worker.onerror = function (msg) { console.log(msg.data); };
worker.addEventListener('error', function (msg) { console.log(msg.data); });
......@@ -186,7 +186,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
worker.postMessage({cmd: 'compile', source: source, optimize: optimize});
};
worker.postMessage({cmd: 'loadVersion', data: url});
};
}
function gatherImports (files, importHints, cb) {
importHints = importHints || [];
......@@ -243,4 +243,4 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
}
}
module.exports = Compiler
module.exports = Compiler;
......@@ -34,5 +34,5 @@ function updateQueryParams (params) {
module.exports = {
get: getQueryParams,
update: updateQueryParams,
};
\ No newline at end of file
update: updateQueryParams
};
......@@ -6,7 +6,6 @@ var utils = require('./utils');
var ExecutionContext = require('./execution-context');
function Renderer (editor, compiler, updateFiles) {
var detailsOpen = {};
var executionContext = new ExecutionContext(compiler);
......@@ -33,7 +32,7 @@ function Renderer (editor, compiler, updateFiles) {
// Switch to file
editor.setCacheFile(errFile);
updateFiles();
// @TODO could show some error icon in files with errors
// @TODO could show some error icon in files with errors
}
editor.handleErrorClick(errLine, errCol);
});
......@@ -43,7 +42,7 @@ function Renderer (editor, compiler, updateFiles) {
return false;
});
}
};
}
this.error = renderError;
var combined = function (contractName, jsonInterface, bytecode) {
......@@ -51,7 +50,6 @@ function Renderer (editor, compiler, updateFiles) {
};
function renderContracts (data, source) {
var udappContracts = [];
for (var contractName in data.contracts) {
var contract = data.contracts[contractName];
......@@ -105,7 +103,7 @@ function Renderer (editor, compiler, updateFiles) {
$contractOutput.find('.title').click(function (ev) { $(this).closest('.contract').toggleClass('hide'); });
$('#output').append($contractOutput);
$('.col2 input,textarea').click(function () { this.select(); });
};
}
this.contracts = renderContracts;
var tableRowItems = function (first, second, cls) {
......@@ -154,7 +152,7 @@ function Renderer (editor, compiler, updateFiles) {
};
var formatGasEstimates = function (data) {
var gasToText = function (g) { return g === null ? 'unknown' : g; }
var gasToText = function (g) { return g === null ? 'unknown' : g; };
var text = '';
var fun;
if ('creation' in data) {
......@@ -217,16 +215,15 @@ function Renderer (editor, compiler, updateFiles) {
});
code += '\n {' +
'\n from: web3.eth.accounts[0], ' +
'\n data: \'' + bytecode + '\', ' +
'\n gas: 3000000' +
'\n }, function (e, contract){' +
'\n console.log(e, contract);' +
'\n if (typeof contract.address !== \'undefined\') {' +
'\n console.log(\'Contract mined! address: \' + contract.address + \' transactionHash: \' + contract.transactionHash);' +
'\n }' +
'\n })';
'\n from: web3.eth.accounts[0], ' +
'\n data: \'' + bytecode + '\', ' +
'\n gas: 3000000' +
'\n }, function (e, contract){' +
'\n console.log(e, contract);' +
'\n if (typeof contract.address !== \'undefined\') {' +
'\n console.log(\'Contract mined! address: \' + contract.address + \' transactionHash: \' + contract.transactionHash);' +
'\n }' +
'\n })';
return code;
}
......@@ -241,7 +238,6 @@ function Renderer (editor, compiler, updateFiles) {
}
return funABI;
}
}
module.exports = Renderer;
......@@ -3,16 +3,14 @@
var utils = require('./utils');
function StorageHandler (updateFiles) {
this.sync = function () {
if (typeof chrome === 'undefined' || !chrome || !chrome.storage || !chrome.storage.sync) {
return;
}
var obj = {};
var done = false;
var count = 0
var count = 0;
var dont = 0;
function check (key) {
......@@ -30,9 +28,9 @@ function StorageHandler (updateFiles) {
if (done >= count) {
chrome.storage.sync.set(obj, function () {
console.log('updated cloud files with: ', obj, this, arguments);
})
});
}
})
});
}
for (var y in window.localStorage) {
......
......@@ -2,4 +2,4 @@ require('es6-shim');
var app = require('./app.js');
var $ = require('jquery');
$(document).ready(function () { app.run(); });
\ No newline at end of file
$(document).ready(function () { app.run(); });
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment