1(function (global) { 2 3 if (global.StatsigSingleton) return; 4 5 let _client = null; 6 let _readyPromiseResolve; 7 let _readyPromise = new Promise(resolve => { 8 _readyPromiseResolve = resolve; 9 }); 10 11 async function init(config) { 12 13 if (_client) return _readyPromise; 14 15 const { 16 clientKey, 17 userID, 18 customIDs, 19 environment 20 } = config; 21 22 const { StatsigClient, StatsigAutoCapturePlugin, StatsigSessionReplayPlugin } = global.Statsig; 23 24 _client = new StatsigClient( 25 clientKey, 26 { 27 userID, 28 customIDs, 29 city: '-' 30 }, 31 { 32 environment: { tier: environment }, 33 plugins: [ 34 new StatsigAutoCapturePlugin({ 35 36 eventFilterFunc: (event) => { 37 if (event.metadata) { 38 delete event.metadata['city']; 39 } 40 if (event.user) { 41 delete event.user.city; 42 if (event.user.custom) { 43 delete event.user.custom.city; 44 } 45 } 46 return event; 47 } 48 49 }), 50 new StatsigSessionReplayPlugin() 51 ] 52 } 53 ); 54 55 _client.initializeAsync() 56 .then(() => { 57 _readyPromiseResolve(); // Resolve the promise 58 }) 59 .catch((e) => { 60 _readyPromiseResolve(); // Resolve the promise 61 }); 62 63 return _readyPromise; 64 } 65 66 function client() { 67 return _client; 68 } 69 70 function ready() { 71 return _readyPromise; 72 } 73 74 global.StatsigSingleton = { 75 init, 76 client, 77 ready 78 }; 79 80})(window); 81 82
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.