Permalink
Browse files

Handle Unity when not available

  • Loading branch information...
1 parent 07f2024 commit 8fba7299bf3da5d2aa4efe42d19e3e7648fab0cf @marcoceppi marcoceppi committed Sep 15, 2012
Showing with 15 additions and 9 deletions.
  1. +15 −9 assets/js/client.js
View
@@ -19,22 +19,28 @@ window.irc = {
};
window.unity = {
- api: external.getUnityObject(1.0),
+ api: null,
connected: false
};
$(function() {
// window.app = new ChatApplicationRouter;
irc.appView = new ChatApplicationView();
-
- window.unity.init({
- name: "Subay IRC",
- iconUrl: window.location.protocol+"//"+window.location.host+"/assets/images/subway.png",
- onInit: function() {
- window.unity.connected = true;
- }
- });
+ try {
+ window.unity.api = external.getUnityObject(1.0);
+ window.unity.init({
+ name: "Subay IRC",
+ iconUrl: window.location.protocol+"//"+window.location.host+"/assets/images/subway.png",
+ onInit: function() {
+ window.unity.connected = true;
+ console.log('Unity support enabled');
+ }
+ });
+ } catch(e) {
+ window.unity.api = null;
+ console.log('Unity support not available');
+ }
// EVENTS //

0 comments on commit 8fba729

Please sign in to comment.