Avatar Diagnostic
AppNavi Avatar Diagnostic function helps detect potential issues in the applications where AppNavi is integrated.
AppNavi Avatar runs on different website where we sometime face the situation where native objects have been modified. Sometimes in a way that don’t conform to the standards.
For example, JSON.parse is one of the most used methods, if its overriden in a non-standard way, it would cause AppNavi to not function correctly.
Also some websites attach event listeners which work in such a way that may prevent proper AppNavi functions.
For example, if following event exists, It may prevent clicking inside the tooltip editor.
window.onselect = function (e) { e.preventDefault(); }
Therefore, looking at the above issues, its necessary for AppNavi to detect which Native objects have been modified and which events have been registered by the website so that when its time to debug the issues, developers are equiped with the information that they need.
What objects does it track?
Currently it checks for the following Native objects. These are the most used objects used in AppNavi.
- Date
- Array
- Object
- String
- Number
- Boolean
- Function
- BigInt
- Symbol
- JSON
- Map
- Set
- WeakMap
- WeakSet
- Promise
- RegExp
- Window
- Document
When its run?
Its run 2 seconds after AppNavi is initialized and only runs when globalDebug is on.
appnavi.runtime.setGlobalDebug(true)
After its run, user can see the output in the console.
Please note that diagnostic output is logged as debug and therefore only visible to user when All or Verbose mode is selected in the browser console.
Manual Call
Sometimes its desirable to not rely on the automatic diagnostic call, instead call it manually. In order to call it manually one can use following code.
appnavi.diagnostic.run()
To see more detailed diagnostics, call diagnostic with true parameter and it will output the method body as well.
appnavi.diagnostic.run(true)
Whats the impact?
In order to keep impact of diagnostic class minimum, we execute it 2 seconds after AppNavi is initialized. Also the automatic run is conditional as it only runs when global debug is on.
Therefore we can say that for normal users, there is no impact at all. For tech users who have global debug enabled, there is only minimum impact as it runs after 2 seconds.
Updated about 1 year ago