File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 apiUrlPrefix ,
88 version ,
99 defaultNamespace ,
10- sendError
10+ sendError ,
11+ warn
1112) {
1213 try {
1314 /////////////////////
7475 //
7576
7677 // A simple log function so the user knows why a request is not being send
77- var warn = function ( message ) {
78- if ( con && con . warn ) con . warn ( "Simple Analytics:" , message ) ;
78+ warn = function ( ) {
79+ if ( con && con . warn ) {
80+ // 1. Convert args to a normal array
81+ var args = [ ] . slice . call ( arguments ) ;
82+
83+ // 2. Prepend log prefix
84+ args . unshift ( "Simple Analytics:" ) ;
85+
86+ // 3. Pass along arguments to console.warn
87+ con . warn . apply ( con , args ) ;
88+ }
89+ } ;
90+
91+ var warnInFunction = function ( name , error ) {
92+ warn ( "Error in your " + name + " function:" , error ) ;
7993 } ;
8094
8195 var hasProp = function ( obj , prop ) {
445459 ? Intl . DateTimeFormat ( ) . resolvedOptions ( ) . timeZone
446460 : undefinedVar ;
447461 } catch ( e ) {
448- /* Do nothing */
462+ warn ( error ) ;
449463 }
450464
451465 /////////////////////
637651 ) * 5
638652 ) ;
639653 } catch ( error ) {
654+ warn ( error ) ;
640655 return 0 ;
641656 }
642657 } ;
763778 try {
764779 performaceEntryType = perf . getEntriesByType ( navigationText ) [ 0 ] . type ;
765780 } catch ( error ) {
766- // Do nothing
781+ warn ( error ) ;
767782 }
768783
769784 var userNavigated = performaceEntryType
You can’t perform that action at this time.
0 commit comments