2018-03-15 11:00:24 +01:00
|
|
|
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
|
|
|
|
|
|
|
# AnTOS Web desktop is is licensed under the GNU General Public
|
|
|
|
# License v3.0, see the LICENCE file for more information
|
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of
|
|
|
|
# the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
#along with this program. If not, see https://www.gnu.org/licenses/.
|
|
|
|
|
2017-08-16 00:27:32 +02:00
|
|
|
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
|
2017-08-16 00:27:32 +02:00
|
|
|
attach: (h) ->
|
|
|
|
@holder = h
|
|
|
|
|
2017-08-15 02:56:04 +02:00
|
|
|
update: () -> @holder.update() if @holder
|
2017-08-16 00:27:32 +02:00
|
|
|
|
2017-08-15 02:56:04 +02:00
|
|
|
watch: ( t, f) ->
|
|
|
|
me = @
|
|
|
|
func = () ->
|
|
|
|
f()
|
|
|
|
me.timer = setTimeout (() -> func()), t
|
|
|
|
func()
|
2017-08-16 00:27:32 +02:00
|
|
|
onexit: (evt) ->
|
2017-08-15 02:56:04 +02:00
|
|
|
console.log "clean timer" if @timer
|
|
|
|
clearTimeout @timer if @timer
|
2017-08-16 00:27:32 +02:00
|
|
|
@cleanup(evt)
|
|
|
|
($ @scheme).remove() if @scheme
|
|
|
|
|
2017-08-15 02:56:04 +02:00
|
|
|
main: () ->
|
|
|
|
show: () ->
|
2017-08-16 00:27:32 +02:00
|
|
|
awake: (e) ->
|
2017-08-15 02:56:04 +02:00
|
|
|
#implement by user to tart the service
|
2017-08-16 00:27:32 +02:00
|
|
|
cleanup: (evt) ->
|
2017-08-15 02:56:04 +02:00
|
|
|
#implemeted by user
|
|
|
|
BaseService.type = 2
|
2017-08-16 00:27:32 +02:00
|
|
|
BaseService.singleton = true
|
2017-08-15 02:56:04 +02:00
|
|
|
this.OS.GUI.BaseService = BaseService
|