PHP Classes

File: public/js/app/app.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy   Silex MVC Blog   public/js/app/app.js   Download  
File: public/js/app/app.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Silex MVC Blog
MVC based blog using on the Silex micro-framework
Author: By
Last change: Add TodoMVC for Vue.js
Date: 8 years ago
Size: 2,380 bytes
 

Contents

Class file image Download
define(['app/system', 'app/lang'], function (System, Lang) { /** * App - application * * * JavaScript * * @author Sergii Beskorovainyi <bsa2657@yandex.ru> * @license MIT <http://www.opensource.org/licenses/mit-license.php> * @link https://github.com/bsa-git/silex-mvc/ */ var App = Class.extend({ init: function () { try { // Create System object this.sys = new System(); // Create Lang(language) object this.lb = new Lang(this.sys); // Create resources this.createResources(); } catch (ex) { if (ex instanceof Error) { var message = ex.stack; if (this.sys && this.sys.messagebox_write) { this.sys.messagebox_write('warning', [message]); } else { alert(message); } } } }, createResources: function () { // Add script resources if (undefined !== window.BSA) { $.each(BSA.ScriptResources, function (i, resName) { require([resName], function (resClass) { // Receive settings to create the object var params = BSA.ScriptParams[resName]; // The function to create objects of their parameters var createObject = function (param) { var resObjects = BSA.ScriptInstances[resName]; if (resObjects) { resObjects.push(new resClass(param)); } else { BSA.ScriptInstances[resName] = [new resClass(param)]; } }; // Creating objects if (params) { $.each(params, function (i, param) { createObject(param); }); } else { createObject(); } }); }); } } }); return App; });