From ec37d6be71262e281bc90902bf6ceac88be3ebc8 Mon Sep 17 00:00:00 2001 From: Tobias Hintze Date: Fri, 12 Jul 2013 16:00:07 +0200 Subject: [PATCH] add onStartup handler for dojo init --- js/office.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/office.js b/js/office.js index 62001102..3c62309f 100644 --- a/js/office.js +++ b/js/office.js @@ -1,5 +1,11 @@ -/*globals $,OC,fileDownloadPath,t,document,odf,webodfEditor */ +/*globals $,OC,fileDownloadPath,t,document,odf,webodfEditor,alert,require */ var officeMain = { + onStartup: function() { + "use strict"; alert("ready A"); + require(["dojo/ready"], function(ready) { + ready(function(){alert("ready B!");}); + }); + }, onView: function(dir, file) { "use strict"; (function no_op() {return {no_op:function(){}};}()).no_op(function() { @@ -65,12 +71,6 @@ var officeMain = { }; $(document).ready(function() { - alert("ready A"); - OC.addScript('office', 'dojo-amalgamation', function() { - require(["dojo/ready"], function(ready) { - ready(function(){alert("ready B!");}); - }); - }); $('.documentslist tr').click(function(event) { @@ -78,4 +78,5 @@ $(document).ready(function() { officeMain.onView('', $(this).attr('data-file')); }); $('#odf_close').live('click', officeMain.onClose); + OC.addScript('office', 'dojo-amalgamation', officeMain.onStartup); });