@@ -95,26 +95,26 @@ class Glean {
9595 }
9696
9797 /**
98- * Handles the changing of state from upload disabled to enabled.
99- *
100- * Should only be called when the state actually changes.
101- *
102- * The `uploadEnabled` flag is set to true and the core Glean metrics are recreated.
103- */
98+ * Handles the changing of state from upload disabled to enabled.
99+ *
100+ * Should only be called when the state actually changes.
101+ *
102+ * The `uploadEnabled` flag is set to true and the core Glean metrics are recreated.
103+ */
104104 private static async onUploadEnabled ( ) : Promise < void > {
105105 Glean . uploadEnabled = true ;
106106 await Glean . coreMetrics . initialize ( ) ;
107107 }
108108
109109 /**
110- * Handles the changing of state from upload enabled to disabled.
111- *
112- * Should only be called when the state actually changes.
113- *
114- * A deletion_request ping is sent, all pending metrics, events and queued
115- * pings are cleared, and the client_id is set to KNOWN_CLIENT_ID.
116- * Afterward, the upload_enabled flag is set to false.
117- */
110+ * Handles the changing of state from upload enabled to disabled.
111+ *
112+ * Should only be called when the state actually changes.
113+ *
114+ * A deletion_request ping is sent, all pending metrics, events and queued
115+ * pings are cleared, and the client_id is set to KNOWN_CLIENT_ID.
116+ * Afterward, the upload_enabled flag is set to false.
117+ */
118118 private static async onUploadDisabled ( ) : Promise < void > {
119119 Glean . uploadEnabled = false ;
120120 await Glean . clearMetrics ( ) ;
@@ -124,10 +124,10 @@ class Glean {
124124 }
125125
126126 /**
127- * Clears any pending metrics and pings.
128- *
129- * This function is only supposed to be called when telemetry is disabled.
130- */
127+ * Clears any pending metrics and pings.
128+ *
129+ * This function is only supposed to be called when telemetry is disabled.
130+ */
131131 private static async clearMetrics ( ) : Promise < void > {
132132 // Stop ongoing upload jobs and clear pending pings queue.
133133 await Glean . pingUploader . clearPendingPingsQueue ( ) ;
@@ -180,26 +180,26 @@ class Glean {
180180 }
181181
182182 /**
183- * Initialize Glean. This method should only be called once, subsequent calls will be no-op.
184- *
185- * # Note
186- *
187- * Before this method is called Glean will not be able to upload pings or record metrics,
188- * all such operations will be no-op.
189- *
190- * This is _not_ the way glean-core deals with this. It will record tasks performed before init
191- * and flush them on init. We have a bug to figure out how to do that for Glean.js, Bug 1687491.
192- *
193- * @param applicationId The application ID (will be sanitized during initialization).
194- * @param uploadEnabled Determines whether telemetry is enabled.
195- * If disabled, all persisted metrics, events and queued pings
196- * (except first_run_date) are cleared.
197- * @param config Glean configuration options.
198- *
199- * @throws
200- * - If config.serverEndpoint is an invalid URL;
201- * - If the application if is an empty string.
202- */
183+ * Initialize Glean. This method should only be called once, subsequent calls will be no-op.
184+ *
185+ * # Note
186+ *
187+ * Before this method is called Glean will not be able to upload pings or record metrics,
188+ * all such operations will be no-op.
189+ *
190+ * This is _not_ the way glean-core deals with this. It will record tasks performed before init
191+ * and flush them on init. We have a bug to figure out how to do that for Glean.js, Bug 1687491.
192+ *
193+ * @param applicationId The application ID (will be sanitized during initialization).
194+ * @param uploadEnabled Determines whether telemetry is enabled.
195+ * If disabled, all persisted metrics, events and queued pings
196+ * (except first_run_date) are cleared.
197+ * @param config Glean configuration options.
198+ *
199+ * @throws
200+ * - If config.serverEndpoint is an invalid URL;
201+ * - If the application if is an empty string.
202+ */
203203 static initialize (
204204 applicationId : string ,
205205 uploadEnabled : boolean ,
@@ -346,30 +346,30 @@ class Glean {
346346 }
347347
348348 /**
349- * Determines whether upload is enabled.
350- *
351- * When upload is disabled, no data will be recorded.
352- *
353- * @returns Whether upload is enabled.
354- */
349+ * Determines whether upload is enabled.
350+ *
351+ * When upload is disabled, no data will be recorded.
352+ *
353+ * @returns Whether upload is enabled.
354+ */
355355 static isUploadEnabled ( ) : boolean {
356356 return Glean . uploadEnabled ;
357357 }
358358
359359 /**
360- * Sets whether upload is enabled or not.
361- *
362- * When uploading is disabled, metrics aren't recorded at all and no
363- * data is uploaded.
364- *
365- * When disabling, all pending metrics, events and queued pings are cleared.
366- *
367- * When enabling, the core Glean metrics are recreated.
368- *
369- * If the value of this flag is not actually changed, this is a no-op.
370- *
371- * @param flag When true, enable metric collection.
372- */
360+ * Sets whether upload is enabled or not.
361+ *
362+ * When uploading is disabled, metrics aren't recorded at all and no
363+ * data is uploaded.
364+ *
365+ * When disabling, all pending metrics, events and queued pings are cleared.
366+ *
367+ * When enabling, the core Glean metrics are recreated.
368+ *
369+ * If the value of this flag is not actually changed, this is a no-op.
370+ *
371+ * @param flag When true, enable metric collection.
372+ */
373373 static setUploadEnabled ( flag : boolean ) : void {
374374 Glean . dispatcher . launch ( async ( ) => {
375375 if ( ! Glean . initialized ) {
@@ -392,12 +392,12 @@ class Glean {
392392 }
393393
394394 /**
395- * Sets the `logPings` flag.
396- *
397- * When this flag is `true` pings will be logged to the console right before they are collected.
398- *
399- * @param flag Whether or not to log pings.
400- */
395+ * Sets the `logPings` flag.
396+ *
397+ * When this flag is `true` pings will be logged to the console right before they are collected.
398+ *
399+ * @param flag Whether or not to log pings.
400+ */
401401 static setLogPings ( flag : boolean ) : void {
402402 Glean . dispatcher . launch ( ( ) => {
403403 // It is guaranteed that _config will have a value here.
@@ -418,30 +418,30 @@ class Glean {
418418 }
419419
420420 /**
421- * Sets the current environment.
422- *
423- * This function **must** be called before Glean.initialize.
424- *
425- * @param platform The environment to set.
426- * Please check out the available environments in the platform/ module.
427- */
421+ * Sets the current environment.
422+ *
423+ * This function **must** be called before Glean.initialize.
424+ *
425+ * @param platform The environment to set.
426+ * Please check out the available environments in the platform/ module.
427+ */
428428 static setPlatform ( platform : Platform ) : void {
429429 Glean . instance . _platform = platform ;
430430 }
431431
432432 /**
433- * **Test-only API**
434- *
435- * Initializes Glean in testing mode.
436- *
437- * All platform specific APIs will be mocked.
438- *
439- * @param applicationId The application ID (will be sanitized during initialization).
440- * @param uploadEnabled Determines whether telemetry is enabled.
441- * If disabled, all persisted metrics, events and queued pings (except
442- * first_run_date) are cleared. Default to `true`.
443- * @param config Glean configuration options.
444- */
433+ * **Test-only API**
434+ *
435+ * Initializes Glean in testing mode.
436+ *
437+ * All platform specific APIs will be mocked.
438+ *
439+ * @param applicationId The application ID (will be sanitized during initialization).
440+ * @param uploadEnabled Determines whether telemetry is enabled.
441+ * If disabled, all persisted metrics, events and queued pings (except
442+ * first_run_date) are cleared. Default to `true`.
443+ * @param config Glean configuration options.
444+ */
445445 static async testInitialize ( applicationId : string , uploadEnabled = true , config ?: Configuration ) : Promise < void > {
446446 Glean . setPlatform ( TestPlatform ) ;
447447 Glean . initialize ( applicationId , uploadEnabled , config ) ;
@@ -450,12 +450,12 @@ class Glean {
450450 }
451451
452452 /**
453- * **Test-only API**
454- *
455- * Resets the Glean to an uninitialized state.
456- *
457- * TODO: Only allow this function to be called on test mode (depends on Bug 1682771).
458- */
453+ * **Test-only API**
454+ *
455+ * Resets the Glean to an uninitialized state.
456+ *
457+ * TODO: Only allow this function to be called on test mode (depends on Bug 1682771).
458+ */
459459 static async testUninitialize ( ) : Promise < void > {
460460 // Get back to an uninitialized state.
461461 Glean . instance . _initialized = false ;
@@ -468,18 +468,18 @@ class Glean {
468468 }
469469
470470 /**
471- * **Test-only API**
472- *
473- * Resets the Glean singleton to its initial state and re-initializes it.
474- *
475- * TODO: Only allow this function to be called on test mode (depends on Bug 1682771).
476- *
477- * @param applicationId The application ID (will be sanitized during initialization).
478- * @param uploadEnabled Determines whether telemetry is enabled.
479- * If disabled, all persisted metrics, events and queued pings (except
480- * first_run_date) are cleared. Default to `true`.
481- * @param config Glean configuration options.
482- */
471+ * **Test-only API**
472+ *
473+ * Resets the Glean singleton to its initial state and re-initializes it.
474+ *
475+ * TODO: Only allow this function to be called on test mode (depends on Bug 1682771).
476+ *
477+ * @param applicationId The application ID (will be sanitized during initialization).
478+ * @param uploadEnabled Determines whether telemetry is enabled.
479+ * If disabled, all persisted metrics, events and queued pings (except
480+ * first_run_date) are cleared. Default to `true`.
481+ * @param config Glean configuration options.
482+ */
483483 static async testResetGlean ( applicationId : string , uploadEnabled = true , config ?: Configuration ) : Promise < void > {
484484 await Glean . testUninitialize ( ) ;
485485
0 commit comments