Skip to content

Commit

Permalink
update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Nov 1, 2022
1 parent 44bc976 commit 754e74c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/browser/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ async function loadAnalytics(

/**
* The public browser interface for Segment Analytics
*
* @example
* ```ts
* export const analytics = new AnalyticsBrowser()
* analytics.load({ writeKey: 'foo' })
Expand Down Expand Up @@ -337,12 +339,18 @@ export class AnalyticsBrowser extends AnalyticsBuffered {
}

/**
* Starts loading an analytics instance including:
* * Fetching all destinations configured by the user (if applicable).
* Fully initialize an analytics instance, including:
*
* * Fetching settings from the segment CDN (by default).
* * Fetching all remote destinations configured by the user (if applicable).
* * Flushing buffered analytics events.
* * Loading all middleware.
* * Flushing any analytics events that were captured before this method was called.
*
* Note:️ This method should only be called *once* in your application.
*
* @example
* ```ts
* export const analytics = new AnalyticsBrowser() // nothing loaded yet
* export const analytics = new AnalyticsBrowser()
* analytics.load({ writeKey: 'foo' })
* ```
*/
Expand All @@ -354,6 +362,7 @@ export class AnalyticsBrowser extends AnalyticsBuffered {
/**
* Instantiates an object exposing Analytics methods.
*
* @example
* ```ts
* const ajs = AnalyticsBrowser.load({ writeKey: '<YOUR_WRITE_KEY>' })
*
Expand Down

0 comments on commit 754e74c

Please sign in to comment.