File tree Expand file tree Collapse file tree
packages/analytics/modules/analytics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ type AnalyticsMethod =
2525
2626type MethodForwarder = < K extends keyof Analytics > (
2727 fn : K ,
28- ) => ( ...args : Parameters < Analytics [ K ] > ) => void ;
28+ ) => ( ...args : Parameters < Analytics [ K ] > ) => Promise < void > ;
2929
3030const ANALYTICS_PORT = '@wxt-dev/analytics' ;
3131
@@ -242,6 +242,7 @@ function createFrontendAnalytics(): Analytics {
242242 ( fn ) =>
243243 ( ...args ) => {
244244 port . postMessage ( { fn, args : [ ...args , getFrontendMetadata ( ) ] } ) ;
245+ return Promise . resolve ( ) ;
245246 } ;
246247
247248 const analytics : Analytics = {
Original file line number Diff line number Diff line change 11export interface Analytics {
22 /** Report a page change. */
3- page : ( url : string ) => void ;
3+ page : ( url : string ) => Promise < void > ;
44 /** Report a custom event. */
55 track : (
66 eventName : string ,
77 eventProperties ?: Record < string , string | undefined > ,
8- ) => void ;
8+ ) => Promise < void > ;
99 /** Save information about the user. */
10- identify : ( userId : string , userProperties ?: Record < string , string > ) => void ;
10+ identify : (
11+ userId : string ,
12+ userProperties ?: Record < string , string > ,
13+ ) => Promise < void > ;
1114 /**
1215 * Automatically setup and track user interactions, returning a function to
1316 * remove any listeners that were setup.
1417 */
1518 autoTrack : ( root : Document | ShadowRoot | Element ) => ( ) => void ;
1619 /** Calls `config.enabled.setValue`. */
17- setEnabled : ( enabled : boolean ) => void ;
20+ setEnabled : ( enabled : boolean ) => Promise < void > ;
1821}
1922
2023export interface AnalyticsConfig {
You can’t perform that action at this time.
0 commit comments