fix core api bug

This commit is contained in:
Xuan Sang LE 2018-03-24 00:21:53 +01:00
parent ca647d31c0
commit 57971e4338
4 changed files with 7 additions and 4 deletions

View File

@ -21,4 +21,6 @@ _PM = self.OS.PM
_OS = self.OS _OS = self.OS
_courrier = self.OS.courrier _courrier = self.OS.courrier
this.onload = () -> this.onload = () ->
($ document).on 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', ()->
_GUI.fullscreen = not _GUI.fullscreen
self.OS.boot() self.OS.boot()

View File

@ -36,6 +36,7 @@ class BaseModel
evt = new _GUI.BaseEvent("exit", force) evt = new _GUI.BaseEvent("exit", force)
@onexit(evt) @onexit(evt)
if not evt.prevent if not evt.prevent
@observable.off "*"
delete @.observable delete @.observable
@dialog.quit() if @dialog @dialog.quit() if @dialog
_PM.kill @ _PM.kill @

View File

@ -34,7 +34,7 @@ self.OS or=
courrier: courrier:
observable: riot.observable() observable: riot.observable()
quota: 0 quota: 0
listeners: new Object listeners: {}
on: (e, f, a) -> on: (e, f, a) ->
_courrier.listeners[a.pid] = [] unless _courrier.listeners[a.pid] _courrier.listeners[a.pid] = [] unless _courrier.listeners[a.pid]
_courrier.listeners[a.pid].push { e: e, f: f } _courrier.listeners[a.pid].push { e: e, f: f }
@ -111,6 +111,8 @@ self.OS or=
console.log "Clean up system" console.log "Clean up system"
_PM.killAll a, true for a, v of _PM.processes _PM.killAll a, true for a, v of _PM.processes
_courrier.observable.off("*") if _courrier.observable _courrier.observable.off("*") if _courrier.observable
$(window).off('keydown')
delete _courrier.observable
($ "#wrapper").empty() ($ "#wrapper").empty()
_GUI.clearTheme() _GUI.clearTheme()
_courrier.observable = riot.observable() _courrier.observable = riot.observable()
@ -142,6 +144,7 @@ self.OS or=
exit: -> exit: ->
#do clean up first #do clean up first
f() for n, f of _OS.cleanupHandlers f() for n, f of _OS.cleanupHandlers
_OS.cleanup()
_API.handler.setting (r) -> _API.handler.setting (r) ->
_API.handler.logout() _API.handler.logout()
onexit: (n, f) -> onexit: (n, f) ->

View File

@ -244,8 +244,6 @@ self.OS.GUI =
.css("background-repeat", wp.repeat) .css("background-repeat", wp.repeat)
initDM: -> initDM: ->
($ document).on 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', ()->
_GUI.fullscreen = not _GUI.fullscreen
# check login first # check login first
_API.resource "schemes/dm.html", (x) -> _API.resource "schemes/dm.html", (x) ->
return null unless x return null unless x
@ -400,7 +398,6 @@ self.OS.GUI =
return new _GUI.BasicDialog conf.name, conf.layout return new _GUI.BasicDialog conf.name, conf.layout
login: () -> login: () ->
_OS.cleanup()
_API.resource "schemes/login.html", (x) -> _API.resource "schemes/login.html", (x) ->
return null unless x return null unless x
scheme = $.parseHTML x scheme = $.parseHTML x