From 901d12835ede93ab0f3883f8867c8b107210b035 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 22 Oct 2013 14:54:53 -0700 Subject: move fetchRemotePackage to outside of file packager generated code --- tools/file_packager.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tools/file_packager.py') diff --git a/tools/file_packager.py b/tools/file_packager.py index f8e6efaf..2b7f9731 100644 --- a/tools/file_packager.py +++ b/tools/file_packager.py @@ -529,7 +529,7 @@ if has_preloaded: }; ''' - code += r''' + ret += r''' function fetchRemotePackage(packageName, callback, errback) { var xhr = new XMLHttpRequest(); xhr.open('GET', packageName, true); @@ -569,6 +569,12 @@ if has_preloaded: xhr.send(null); }; + function handleError(error) { + console.error('package error:', error); + }; + ''' + + code += r''' function processPackageData(arrayBuffer) { Module.finishedDataFileDownloads++; assert(arrayBuffer, 'Loading data file failed.'); @@ -577,10 +583,6 @@ if has_preloaded: %s }; Module['addRunDependency']('datafile_%s'); - - function handleError(error) { - console.error('package error:', error); - }; ''' % (use_data, data_target) # use basename because from the browser's point of view, we need to find the datafile in the same dir as the html file code += r''' -- cgit v1.2.3-18-g5258