Added cool json features (JsonWrapper)
This commit is contained in:
@@ -4,7 +4,11 @@ HistoryBuffer = require "../HistoryBuffer.coffee"
|
||||
Engine = require "../Engine.coffee"
|
||||
|
||||
#
|
||||
# Framework for arbitrary Json data-structures.
|
||||
# Framework for Json data-structures.
|
||||
# Known values that are supported:
|
||||
# * String
|
||||
# * Integer
|
||||
# * Array
|
||||
#
|
||||
class JsonYatta
|
||||
constructor: (user_id, Connector)->
|
||||
@@ -21,23 +25,55 @@ class JsonYatta
|
||||
else
|
||||
@root_element = @HB.getOperation(root_elem)
|
||||
|
||||
#
|
||||
# @result JsonType
|
||||
#
|
||||
getRootElement: ()->
|
||||
@root_element
|
||||
|
||||
#
|
||||
# @see Engine
|
||||
#
|
||||
getEngine: ()->
|
||||
@engine
|
||||
|
||||
#
|
||||
# Get the initialized connector.
|
||||
#
|
||||
getConnector: ()->
|
||||
@connector
|
||||
|
||||
#
|
||||
# @see HistoryBuffer
|
||||
#
|
||||
getHistoryBuffer: ()->
|
||||
@HB
|
||||
|
||||
#
|
||||
# @see JsonType.setMutableDefault
|
||||
#
|
||||
setMutableDefault: (mutable)->
|
||||
@root_element.setMutableDefault(mutable)
|
||||
|
||||
#
|
||||
# Get the UserId from the HistoryBuffer object.
|
||||
# In most cases this will be the same as the user_id value with which
|
||||
# JsonYatta was initialized (Depending on the HistoryBuffer implementation).
|
||||
#
|
||||
getUserId: ()->
|
||||
@HB.getUserId()
|
||||
|
||||
val: (name, content)->
|
||||
@root_element.val(name, content)
|
||||
#
|
||||
# @see JsonType.val
|
||||
#
|
||||
val : (name, content, mutable)->
|
||||
@root_element.val(name, content, mutable)
|
||||
|
||||
#
|
||||
# @see JsonType.value
|
||||
#
|
||||
value : ()->
|
||||
@root_element.value
|
||||
|
||||
window?.JsonYatta = JsonYatta
|
||||
module.exports = JsonYatta
|
||||
|
||||
Reference in New Issue
Block a user