Created
September 1, 2017 15:55
-
-
Save dpawluk/a2a0444f27d30830c41398d09228e22d to your computer and use it in GitHub Desktop.
example of using app.registered to call a function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<!-- http://garden.zendesk.com --> | |
<link rel="stylesheet" href="https://assets.zendesk.com/apps/sdk-assets/css/1/zendesk_garden.css" type="text/css"> | |
</head> | |
<body> | |
<h2 class="u-gamma">Hello, World!</h2> | |
<!-- https://github.com/zendesk/zendesk_app_framework_sdk --> | |
<script type="text/javascript" src="https://assets.zendesk.com/apps/sdk/2.0/zaf_sdk.js"></script> | |
<script> | |
// Initialise the Zendesk JavaScript API client | |
// https://developer.zendesk.com/apps/docs/apps-v2 | |
var client = ZAFClient.init(); | |
client.invoke('resize', { width: '100%', height: '200px' }); | |
client.on('app.registered', init); | |
function init(context){ | |
//here you can do all the beginning things and even get the context for your app location. | |
console.log(context); | |
client.get('ticket.requester.timezone.offset').then(function(){ | |
// no we know we have a connection this should work | |
}); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment