@mozilla/rally
Advanced tools
Comparing version
{ | ||
"name": "@mozilla/rally", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "The Rally partner support library.", | ||
@@ -5,0 +5,0 @@ "main": "rally.js", |
30
rally.js
@@ -26,4 +26,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
* } | ||
* @param {Boolean} enableDevMode | ||
* Whether or not to initialize Rally.js in developer mode. | ||
* In this mode we ignore problems when communicating with | ||
* core add-on. | ||
*/ | ||
async initialize(keyId, key) { | ||
async initialize(keyId, key, enableDevMode) { | ||
console.debug("Rally.initialize"); | ||
@@ -35,2 +39,3 @@ | ||
this._key = key; | ||
this._enableDevMode = Boolean(enableDevMode); | ||
@@ -40,3 +45,11 @@ await this._checkRallyCore().then( | ||
).catch( | ||
async () => await browser.tabs.create({ url: SIGNUP_URL }) | ||
async () => { | ||
// Do not prompt recommend installing Rally in | ||
// developer mode. | ||
if (!this._enableDevMode) { | ||
await browser.tabs.create({ url: SIGNUP_URL }); | ||
} else { | ||
console.warn("Rally.initialize - Executing in developer mode."); | ||
} | ||
} | ||
); | ||
@@ -76,6 +89,2 @@ | ||
} | ||
// TODO: in addition to checking if the addon is installed, | ||
// this should check if user has joined the platform by sending | ||
// a message to the addon and waiting for its response. | ||
} | ||
@@ -157,2 +166,11 @@ | ||
// When in developer mode, dump the payload to the console. | ||
if (this._enableDevMode) { | ||
console.log( | ||
`Rally.sendPing - Developer mode. ${payloadType} will not be submitted`, | ||
payload | ||
); | ||
return; | ||
} | ||
// Wrap everything in a try block, as we don't really want | ||
@@ -159,0 +177,0 @@ // data collection to be the culprit of a bug hindering user |
7874
8.04%185
10.78%