"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/templates/package-javascript/lib/__package-name__.js.template" (8 Mar 2017, 1206 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 'use babel';
    2 
    3 import __PackageName__View from './__package-name__-view';
    4 import { CompositeDisposable } from 'atom';
    5 
    6 export default {
    7 
    8   __packageName__View: null,
    9   modalPanel: null,
   10   subscriptions: null,
   11 
   12   activate(state) {
   13     this.__packageName__View = new __PackageName__View(state.__packageName__ViewState);
   14     this.modalPanel = atom.workspace.addModalPanel({
   15       item: this.__packageName__View.getElement(),
   16       visible: false
   17     });
   18 
   19     // Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
   20     this.subscriptions = new CompositeDisposable();
   21 
   22     // Register command that toggles this view
   23     this.subscriptions.add(atom.commands.add('atom-workspace', {
   24       '__package-name__:toggle': () => this.toggle()
   25     }));
   26   },
   27 
   28   deactivate() {
   29     this.modalPanel.destroy();
   30     this.subscriptions.dispose();
   31     this.__packageName__View.destroy();
   32   },
   33 
   34   serialize() {
   35     return {
   36       __packageName__ViewState: this.__packageName__View.serialize()
   37     };
   38   },
   39 
   40   toggle() {
   41     console.log('__PackageName__ was toggled!');
   42     return (
   43       this.modalPanel.isVisible() ?
   44       this.modalPanel.hide() :
   45       this.modalPanel.show()
   46     );
   47   }
   48 
   49 };