Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: templates/geckoInfo.js.tmpl

Issue 29399569: Issue 5060 - Move require into modules template, make info a module (Closed)
Patch Set: Addressed more feedback Created March 31, 2017, 3:15 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: templates/geckoInfo.js.tmpl
diff --git a/templates/geckoInfo.js.tmpl b/templates/geckoInfo.js.tmpl
index 0779ee226a22c555027f3bb7e79eddacb9301bbc..c82d6106cf84e48a6547927fe1d4ca1ab8cc8faf 100644
--- a/templates/geckoInfo.js.tmpl
+++ b/templates/geckoInfo.js.tmpl
@@ -4,25 +4,21 @@
"use strict";
-(function() {
- let info = require.scopes.info = {
- addonName: {{ metadata.get('general', 'basename')|json }},
- addonVersion: {{ version|json }},
+exports.addonName = {{ basename|json }};
+exports.addonVersion = {{ version|json }};
- application: "unknown",
- applicationVersion: "0",
+exports.application = "unknown";
+exports.applicationVersion = "0";
- platform: "gecko",
- platformVersion: "0"
- };
+exports.platform = "gecko";
+exports.platformVersion = "0";
- let match = /\brv:(\d+(?:\.\d+)?)\b/.exec(navigator.userAgent);
- if (match)
- info.platformVersion = match[1];
+let match = /\brv:(\d+(?:\.\d+)?)\b/.exec(navigator.userAgent);
+if (match)
+ exports.platformVersion = match[1];
- browser.runtime.getBrowserInfo().then(function(browserInfo)
- {
- info.application = browserInfo.name.toLowerCase();
- info.applicationVersion = browserInfo.version;
- });
-})();
+browser.runtime.getBrowserInfo().then(browserInfo =>
+{
+ exports.application = browserInfo.name.toLowerCase();
+ exports.applicationVersion = browserInfo.version;
+});

Powered by Google App Engine
This is Rietveld