Added cool json features (JsonWrapper)

This commit is contained in:
Kevin Jahns
2014-08-04 23:35:50 +02:00
parent 5ba735701c
commit 6c34d97432
72 changed files with 2237 additions and 889 deletions

View File

@@ -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