2017-08-07 00:49:24 +02:00
|
|
|
self.OS.API =
|
|
|
|
# the handler object could be a any remote or local handle to
|
|
|
|
# fetch user data, used by the API to make requests
|
|
|
|
# handlers are defined in /src/handlers
|
|
|
|
handler: new Object()
|
|
|
|
|
|
|
|
#request a user data
|
2017-08-16 00:27:32 +02:00
|
|
|
request: (query, callback) ->
|
2017-08-07 00:49:24 +02:00
|
|
|
# definition here
|
2017-08-16 00:27:32 +02:00
|
|
|
handle.request query, callback
|
2017-08-07 00:49:24 +02:00
|
|
|
|
|
|
|
systemConfig: ->
|
|
|
|
_API.request 'config', (result) ->
|
|
|
|
console.log result
|
|
|
|
|
2017-08-16 00:27:32 +02:00
|
|
|
get: (p, c, f) ->
|
|
|
|
$.get p
|
|
|
|
.done (data) -> c(data)
|
|
|
|
.fail -> f()
|
|
|
|
resource: (resource, callback) ->
|
2017-08-11 01:58:46 +02:00
|
|
|
path = "resources/#{resource}"
|
2017-08-16 00:27:32 +02:00
|
|
|
_API.get path, callback
|
2017-08-11 01:58:46 +02:00
|
|
|
|