I added the branch cj-test-for-zcbenz to demonstrate this problem.
If Atom is quit cmd-q values set to localStorage durring the beforeUnload event are not persisted. Here is the output from the cj-test-for-zcbenz branch when Atom is started, quit and then reopen.
[atom] atom -d -f
[9426:0409/110850:INFO:CONSOLE(56)] "-- start --", source: /Users/corey/github/atom/src/window-event-handler.coffee (56)
[9426:0409/110850:INFO:CONSOLE(58)] "am-i-set: null (expect this to be `null` the first time and `true` the second)", source: /Users/corey/github/atom/src/window-event-handler.coffee (58)
[9426:0409/110859:INFO:CONSOLE(60)] "-- beforeunload called --", source: /Users/corey/github/atom/src/window-event-handler.coffee (60)
[9426:0409/110859:INFO:CONSOLE(63)] "am-i-set: true (expect this to `true`)", source: /Users/corey/github/atom/src/window-event-handler.coffee (63)
[atom] a -d -f
[9685:0409/110902:INFO:CONSOLE(56)] "-- start --", source: /Users/corey/github/atom/src/window-event-handler.coffee (56)
[9685:0409/110902:INFO:CONSOLE(58)] "am-i-set: null (expect this to be `null` the first time and `true` the second)", source: /Users/corey/github/atom/src/window-event-handler.coffee (58)
I would expect am-i-set to be true, but it is null. If I close the window cmd-shift-W before I close the app everything works fine and am-i-set is set to true.
If this turns out to be too much work let me know and I will just reimplement localStorage on Atom and have it write to disk.
I added the branch cj-test-for-zcbenz to demonstrate this problem.
If Atom is quit
cmd-qvalues set to localStorage durring thebeforeUnloadevent are not persisted. Here is the output from the cj-test-for-zcbenz branch when Atom is started, quit and then reopen.I would expect
am-i-setto be true, but it is null. If I close the windowcmd-shift-Wbefore I close the app everything works fine andam-i-setis set to true.If this turns out to be too much work let me know and I will just reimplement localStorage on Atom and have it write to disk.