move parse_hex function away from the global context

10.3.x-maintenance
cTn 2014-10-19 04:18:05 +02:00
parent 8477573be5
commit b6097d6271
1 changed files with 14 additions and 14 deletions

View File

@ -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);
}