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
_courrier = self.OS.courrier
this.onload = () ->
($ document).on 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', ()->
_GUI.fullscreen = not _GUI.fullscreen
self.OS.boot()

View File

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

View File

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

View File

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