zendesk_app_framework_sdk
Version:
The Zendesk App Framework (ZAF) SDK is a JavaScript library that simplifies cross-frame communication between iframed apps and ZAF.
42 lines (37 loc) • 860 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Iframe me!</title>
</head>
<body>
<script type="text/javascript" src="assets/zaf_sdk.js"></script>
<script>
var app = window.ZAFClient.init(function(context) {
console.log('Hi', context);
});
app.on('helloIframe', function(data) {
if (data.omg) {
console.log('app says hello');
}
});
app.postMessage('helloApp', { awesome: true });
app.request('/api/v2/tickets.json').then(
function(args) {
console.log('success:', args);
},
function(args) {
console.log('fail:', args);
}
);
app.get('ticket.subject').then(
function(args) {
console.log('success:', args);
},
function(args) {
console.log('fail:', args);
}
);
</script>
</body>
</html>