mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
Make sure window.shutdown is only called once
This commit is contained in:
parent
43aa1aaeb7
commit
b24a13991a
@ -109,3 +109,9 @@ describe "Window", ->
|
|||||||
shutdown()
|
shutdown()
|
||||||
|
|
||||||
expect(editor1.getBuffer().subscriptionCount()).toBe 0
|
expect(editor1.getBuffer().subscriptionCount()).toBe 0
|
||||||
|
|
||||||
|
it "only serializes window state the first time it is called", ->
|
||||||
|
deactivateSpy = spyOn(atom, "setRootViewStateForPath").andCallThrough()
|
||||||
|
window.shutdown()
|
||||||
|
window.shutdown()
|
||||||
|
expect(atom.setRootViewStateForPath.callCount).toBe 1
|
||||||
|
@ -8,6 +8,7 @@ require 'underscore-extensions'
|
|||||||
require 'space-pen-extensions'
|
require 'space-pen-extensions'
|
||||||
|
|
||||||
deserializers = {}
|
deserializers = {}
|
||||||
|
wasShutdown = false
|
||||||
|
|
||||||
windowAdditions =
|
windowAdditions =
|
||||||
rootViewParentSelector: 'body'
|
rootViewParentSelector: 'body'
|
||||||
@ -68,6 +69,8 @@ windowAdditions =
|
|||||||
$(rootViewParentSelector).append(rootView)
|
$(rootViewParentSelector).append(rootView)
|
||||||
|
|
||||||
shutdown: ->
|
shutdown: ->
|
||||||
|
return if wasShutdown
|
||||||
|
wasShutdown = true
|
||||||
atom.setWindowState('pathToOpen', project.getPath())
|
atom.setWindowState('pathToOpen', project.getPath())
|
||||||
atom.setRootViewStateForPath project.getPath(),
|
atom.setRootViewStateForPath project.getPath(),
|
||||||
project: project.serialize()
|
project: project.serialize()
|
||||||
|
Loading…
Reference in New Issue
Block a user