From b6097d62715169aa6019d312f8e9aeb049f7acca Mon Sep 17 00:00:00 2001 From: cTn Date: Sun, 19 Oct 2014 04:18:05 +0200 Subject: [PATCH] move parse_hex function away from the global context --- tabs/firmware_flasher.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tabs/firmware_flasher.js b/tabs/firmware_flasher.js index 64ba5bcc..ab275212 100644 --- a/tabs/firmware_flasher.js +++ b/tabs/firmware_flasher.js @@ -16,6 +16,19 @@ TABS.firmware_flasher.initialize = function (callback) { // translate to user-selected language 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 $('a.load_file').click(function () { chrome.fileSystem.chooseEntry({type: 'openFile', accepts: [{extensions: ['hex']}]}, function (fileEntry) { @@ -340,17 +353,4 @@ TABS.firmware_flasher.cleanup = function (callback) { $(document).unbind('keypress'); 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); -} \ No newline at end of file +}; \ No newline at end of file