1
YUI.add('unity', function (Y, NAME) {
5
var init_callbacks = [],
6
ns = Y.namespace("Unity");
10
function unityReady() {
12
init_callbacks.reverse();
13
while (init_callbacks.length > 0) {
14
var callback = init_callbacks.pop();
19
/* Initialise Unity Webapps integration. Should only be called once. */
20
ns.init = function init(parameters) {
21
if (typeof external !== "undefined" && external && external.getUnityObject) {
22
var Unity = external.getUnityObject(1.0);
24
if (parameters.onInit) {
25
ns.onInit(parameters.onInit);
27
parameters.onInit = unityReady;
28
Unity.init(parameters);
32
/* Add a callback that will be fired when Unity Webapps
33
* integration is enabled. If integration has already been
34
* enabled, then the callback will be run immediately. */
35
ns.onInit = function onInit(callback) {
39
init_callbacks.push(callback);
44
}, '@VERSION@', {"requires": []});