move parse_hex function away from the global context
parent
8477573be5
commit
b6097d6271
|
@ -16,6 +16,19 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
localize();
|
localize();
|
||||||
|
|
||||||
|
function parse_hex(str, callback) {
|
||||||
|
// parsing hex in different thread
|
||||||
|
var worker = new Worker('./js/workers/hex_parser.js');
|
||||||
|
|
||||||
|
// "callback"
|
||||||
|
worker.onmessage = function (event) {
|
||||||
|
callback(event.data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// send data/string over for processing
|
||||||
|
worker.postMessage(str);
|
||||||
|
}
|
||||||
|
|
||||||
// UI Hooks
|
// UI Hooks
|
||||||
$('a.load_file').click(function () {
|
$('a.load_file').click(function () {
|
||||||
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: [{extensions: ['hex']}]}, function (fileEntry) {
|
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: [{extensions: ['hex']}]}, function (fileEntry) {
|
||||||
|
@ -340,17 +353,4 @@ TABS.firmware_flasher.cleanup = function (callback) {
|
||||||
$(document).unbind('keypress');
|
$(document).unbind('keypress');
|
||||||
|
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
};
|
};
|
||||||
|
|
||||||
function parse_hex(str, callback) {
|
|
||||||
// parsing hex in different thread
|
|
||||||
var worker = new Worker('./js/workers/hex_parser.js');
|
|
||||||
|
|
||||||
// "callback"
|
|
||||||
worker.onmessage = function (event) {
|
|
||||||
callback(event.data);
|
|
||||||
};
|
|
||||||
|
|
||||||
// send data/string over for processing
|
|
||||||
worker.postMessage(str);
|
|
||||||
}
|
|
Loading…
Reference in New Issue