Metal Detector / js /
app.js
/*
* Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
*
* 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.
*/
/*global window*/
/**
* Main application module.
* Provides a namespace for other application modules.
* Handles application life cycle.
*
* @module app
* @requires {@link app.ui}
* @namespace app
*/
// make sure that "app" namespace is created
window.app = window.app || {};
// strict mode wrapper
(function defineApp(app) {
'use strict';
/**
* Handles tizenhwkey event.
*
* @memberof app
* @private
* @param {Event} event
*/
function onHardwareKeysTap(event) {
if (event.keyName === 'back') {
app.model.exitApplication();
}
}
/**
* Binds events.
*
* @memberof app
* @private
*/
function bindEvents() {
window.addEventListener('tizenhwkey', onHardwareKeysTap);
}
/**
* Initialize application.
*
* @memberof app
* @private
*/
function init() {
bindEvents();
app.ui.init();
}
window.addEventListener('load', init);
})(window.app);