DEVELOPER CENTER
JavaScript
7min
learn how to build and manage your integrations using pathfix client library get documentation, example code, tutorials, and more common concepts the pathfix oauth library is loaded by including the helper js in the following manner although the oauth js can be loaded from the same location it will not work independently it needs a few dependencies that are loaded by the helper js pathfix, onload when the pathfix helper library is ready it calls back a global function on the page this is the place you should be attaching handlers to monitor the loading of other libraries see example below\ event handlers events to all pathfix libraries are attached using a standard syntax //adding an event listener $pinc events on(library,eventname,callback,forceinvoke); //removing an event listener $pinc events off(library,eventname,callback); arguments library required name of the library that you'd want to attach to for oauth library use "$pinc oauth" "$pinc oauth" as a string eventname required eventname to be sent across as string eg "ready" "ready" callback required event handler reference forceinvoke optional if true, it forces your callback to be invoked if the event was fired before you attached your handler example $pinc events on("$pinc oauth","ready",callback,true); method calls most method calls in pathfix need callback as the final argument method calls are made to the library using their object reference below is the list of libraries available $pinc all global functions are accessible using this object $pinc oauth pathfix oauth library