blank package
This commit is contained in:
commit
ffbe36efec
12 changed files with 210 additions and 0 deletions
22
lib/ex-mode-view.coffee
Normal file
22
lib/ex-mode-view.coffee
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
module.exports =
|
||||
class ExModeView
|
||||
constructor: (serializeState) ->
|
||||
# Create root element
|
||||
@element = document.createElement('div')
|
||||
@element.classList.add('ex-mode')
|
||||
|
||||
# Create message element
|
||||
message = document.createElement('div')
|
||||
message.textContent = "The ExMode package is Alive! It's ALIVE!"
|
||||
message.classList.add('message')
|
||||
@element.appendChild(message)
|
||||
|
||||
# Returns an object that can be retrieved when package is activated
|
||||
serialize: ->
|
||||
|
||||
# Tear down any state and detach
|
||||
destroy: ->
|
||||
@element.remove()
|
||||
|
||||
getElement: ->
|
||||
@element
|
||||
33
lib/ex-mode.coffee
Normal file
33
lib/ex-mode.coffee
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
ExModeView = require './ex-mode-view'
|
||||
{CompositeDisposable} = require 'atom'
|
||||
|
||||
module.exports = ExMode =
|
||||
exModeView: null
|
||||
modalPanel: null
|
||||
subscriptions: null
|
||||
|
||||
activate: (state) ->
|
||||
@exModeView = new ExModeView(state.exModeViewState)
|
||||
@modalPanel = atom.workspace.addModalPanel(item: @exModeView.getElement(), visible: false)
|
||||
|
||||
# Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
|
||||
@subscriptions = new CompositeDisposable
|
||||
|
||||
# Register command that toggles this view
|
||||
@subscriptions.add atom.commands.add 'atom-workspace', 'ex-mode:toggle': => @toggle()
|
||||
|
||||
deactivate: ->
|
||||
@modalPanel.destroy()
|
||||
@subscriptions.dispose()
|
||||
@exModeView.destroy()
|
||||
|
||||
serialize: ->
|
||||
exModeViewState: @exModeView.serialize()
|
||||
|
||||
toggle: ->
|
||||
console.log 'ExMode was toggled!'
|
||||
|
||||
if @modalPanel.isVisible()
|
||||
@modalPanel.hide()
|
||||
else
|
||||
@modalPanel.show()
|
||||
Loading…
Add table
Add a link
Reference in a new issue