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 some feedback Created March 31, 2017, 1:57 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..226bc677e5371361bf10d62124bd71d214ba4cbe 100644
--- a/templates/geckoInfo.js.tmpl
+++ b/templates/geckoInfo.js.tmpl
@@ -4,25 +4,23 @@
"use strict";
-(function() {
- let info = require.scopes.info = {
- addonName: {{ metadata.get('general', 'basename')|json }},
- addonVersion: {{ version|json }},
+exports = module.exports = {
+ addonName: {{ basename|json }},
+ addonVersion: {{ version|json }},
- application: "unknown",
- applicationVersion: "0",
+ application: "unknown",
+ applicationVersion: "0",
- platform: "gecko",
- platformVersion: "0"
- };
+ platform: "gecko",
+ 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