2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 /*jslint devel: true*/
18 /*global $, tizen, App */
21 * This file acts as a loader for the application and its dependencies
23 * First, the 'app.js' script is loaded .
24 * Then, scripts defined in 'app.requires' are loaded.
25 * Finally, the app is initialised - the app is instantiated ('app = new App()')
26 * and 'app.init()' is called.
31 (function () { // strict mode wrapper
36 * Loader init - load the App constructor
38 init: function init() {
40 $.getScript('js/app.js')
42 // once the app is loaded, create the app object
43 // and load the libraries
47 .fail(this.onGetScriptError);
53 loadLibs: function loadLibs() {
55 if ($.isArray(app.requires)) {
56 $.each(app.requires, function (index, filename) {
60 if (loadedLibs >= app.requires.length) {
61 // all dependencies are loaded,
66 .fail(this.onGetScriptError);
74 onGetScriptError: function onGetScriptError(
80 console.error('An error occurred: ' + e.message);
83 }).init(); // run the loader