UNPKG

electron-kit

Version:

Utility kits for middle-scale electron app

66 lines (48 loc) 1.99 kB
// Generated by CoffeeScript 1.10.0 (function() { var Application, CommandManager, ConfigManager, ContextMenuManager, Emitter, MenuManagerProxy, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Emitter = require("../utils/Emitter"); CommandManager = require("./CommandManager"); ContextMenuManager = require("./ContextMenuManager"); ConfigManager = require("./ConfigManager"); MenuManagerProxy = require("./MenuManagerProxy"); module.exports = Application = (function(superClass) { extend(Application, superClass); Application.prototype.command = null; function Application(options) { this.options = options != null ? options : {}; Application.__super__.constructor.apply(this, arguments); this._initializeModules(); this._handleEvents(); } /** * @protected */ Application.prototype._initializeModules = function() { this.command = new CommandManager(this.options); this.contextMenu = new ContextMenuManager(this.options); this.config = new ConfigManager(this.options); this.menu = new MenuManagerProxy(this.options); }; /** * @protected */ Application.prototype._handleEvents = function() { this.contextMenu.onDidClickCommandItem((function(_this) { return function(command, el) { return _this.command.dispatch(command, el); }; })(this)); window.addEventListener("contextmenu", (function(_this) { return function(e) { return setTimeout(function() { return _this.contextMenu.showForElementPath(e.path); }, 0); }; })(this)); }; return Application; })(Emitter); }).call(this);