summaryrefslogtreecommitdiff
path: root/ext/bg/js/import.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/import.js')
-rw-r--r--ext/bg/js/import.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/bg/js/import.js b/ext/bg/js/import.js
index 905b4580..ebc7c7be 100644
--- a/ext/bg/js/import.js
+++ b/ext/bg/js/import.js
@@ -17,7 +17,16 @@
*/
-chrome.runtime.onMessage.addListener(({state, progress}, sender, callback) => {
- $('.progress-bar').css('width', progress + '%');
+function api_setProgress({state, progress}) {
+ const str = `${progress}%`;
+ $('.progress-bar').css('width', str).text(str);
+}
+
+chrome.runtime.onMessage.addListener(({action, params}, sender, callback) => {
+ const method = this['api_' + action];
+ if (typeof(method) === 'function') {
+ method.call(this, params);
+ }
+
callback();
});