antos-frontend/src/core/BaseService.coffee

41 lines
1.0 KiB
CoffeeScript
Raw Normal View History

class BaseService extends this.OS.GUI.BaseModel
2017-08-27 23:40:02 +02:00
constructor: (name, args) ->
super name, args
2017-08-15 02:56:04 +02:00
@icon = undefined
@iconclass = "fa-paper-plane-o"
@text = ""
@timer = undefined
@holder = undefined
init: ()->
#implement by user
# event registe, etc
# scheme loader
2017-08-24 01:53:13 +02:00
meta: () ->
2018-02-01 19:36:09 +01:00
_OS.APP[@name].meta
attach: (h) ->
@holder = h
2017-08-15 02:56:04 +02:00
update: () -> @holder.update() if @holder
2017-08-15 02:56:04 +02:00
watch: ( t, f) ->
me = @
func = () ->
f()
me.timer = setTimeout (() -> func()), t
func()
onexit: (evt) ->
2017-08-15 02:56:04 +02:00
console.log "clean timer" if @timer
clearTimeout @timer if @timer
@cleanup(evt)
($ @scheme).remove() if @scheme
2017-08-15 02:56:04 +02:00
main: () ->
show: () ->
awake: (e) ->
2017-08-15 02:56:04 +02:00
#implement by user to tart the service
cleanup: (evt) ->
2017-08-15 02:56:04 +02:00
#implemeted by user
BaseService.type = 2
BaseService.singleton = true
2017-08-15 02:56:04 +02:00
this.OS.GUI.BaseService = BaseService