During the lifecycle of an app, i.e. when the READY
, SHOW
and CHANGE
events occur, data is passed via the event to the hook that you inmplement in your app code. We provide a core SDK for interacting with these events and basic usage is as follows.
import { createClient } from "@deskpro/app-sdk";
// Create a Deskpro client instance using our SDK
const client = createClient();
// Run the client after the page has loaded, so that a connection to Deskpro can be made after setup
window.onload = () => client.run();
client.onReady((context) => {
// do something when the app is ready
});
client.onShow((context) => {
// do something when the app is shown to the user
});
client.onChange((context) => {
// do something when the "context" data has changed
}); copy
In the above example you'll notice that a context
object is passed via the associated event.
Fore a more in-depth guide on how to start building your first app, take a look at our how-to guides.
Please log in or register to submit a comment.