Skip to content

The Zendesk App Framework (ZAF) SDK is a JavaScript library that simplifies cross-frame communication between iframed apps and the Zendesk App Framework

License

Notifications You must be signed in to change notification settings

UseFedora/zendesk_app_framework_sdk

 
 

Repository files navigation

Use of this software is subject to important terms and conditions as set forth in the License file

Zendesk App Framework SDK

Build Status

What is it?

The Zendesk App Framework (ZAF) SDK is a JavaScript micro-library that simplifies cross-frame communication between iframed apps and ZAF. See Iframes in Apps to learn more.

How does it work?

iframed website

<script type="text/javascript" src="http://assets.zendesk.com/apps/sdk/1.0/zaf_sdk.js"></script>
<script>
  var app = window.ZAFClient.init(function(context) {
    var currentUser = context.currentUser;
    console.log('Hi ' + currentUser.name);
  });

  app.on('helloIframe', function(data) {
    if (data.omg) {
      console.log('app says hello');
    }
  });

  app.postMessage('helloApp', { awesome: true });
</script>

iframe.hdbs

{{iframe "https://dashboard.myapp.com"}}

app.js

events: {
  'app.created':     'init',
  'app.registered':  'onAppRegistered',
  'iframe.helloApp': 'handleHello'
},

init: function() {
  this.switchTo('iframe');
},

onAppRegistered: function() {
  this.postMessage('helloIframe', { omg: true })
},

handleHello: function(data) {
  if (data.awesome) {
    console.log('iframe says hello');
  }
}

For development...

You will need:

Then run:

npm install - Install dependencies

grunt server - Serve the public directory at http://localhost:9001

Contributing

Improvements are always welcome. Please follow these steps to contribute:

  1. Submit a Pull Request with a detailed explanation of changes
  2. Receive a 👍 from a core team member
  3. Core team will merge your changes

Copyright and license

Copyright 2014 Zendesk

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

The Zendesk App Framework (ZAF) SDK is a JavaScript library that simplifies cross-frame communication between iframed apps and the Zendesk App Framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.0%
  • HTML 2.0%