27 lines
457 B
CoffeeScript
27 lines
457 B
CoffeeScript
class Session
|
|
|
|
vk_params: null
|
|
user: null
|
|
|
|
constructor: (params) ->
|
|
attrs = ['expire', 'mid', 'secret', 'sid', 'sig']
|
|
_params = {}
|
|
for key in attrs
|
|
if params[key]?
|
|
_params[key] = params[key]
|
|
@vk_params = _params
|
|
|
|
setUser: (user) ->
|
|
@user = user
|
|
false
|
|
|
|
getUser: ->
|
|
@user
|
|
|
|
query: (url, params, callback) ->
|
|
q_params = @vk_params
|
|
for attr in params
|
|
q_params[attr] = params[attr]
|
|
$.post url, q_params, callback
|
|
false
|