Documentation and cleanup

This commit is contained in:
Kevin Jahns
2014-08-24 01:52:15 +02:00
parent 77739deda3
commit 86849ae8b1
496 changed files with 10102 additions and 87342 deletions

View File

@@ -0,0 +1,95 @@
(function() {
var Engine, HistoryBuffer, JsonFramework, json_types_uninitialized;
json_types_uninitialized = require("../Types/JsonTypes");
HistoryBuffer = require("../HistoryBuffer");
Engine = require("../Engine");
JsonFramework = (function() {
function JsonFramework(user_id, Connector) {
var first_word, type_manager;
this.HB = new HistoryBuffer(user_id);
type_manager = json_types_uninitialized(this.HB);
this.types = type_manager.types;
this.engine = new Engine(this.HB, type_manager.parser);
this.connector = new Connector(this.engine, this.HB, type_manager.execution_listener, this);
first_word = new this.types.JsonType(this.HB.getReservedUniqueIdentifier());
this.HB.addOperation(first_word).execute();
this.root_element = first_word;
}
JsonFramework.prototype.getSharedObject = function() {
return this.root_element;
};
JsonFramework.prototype.getConnector = function() {
return this.connector;
};
JsonFramework.prototype.getHistoryBuffer = function() {
return this.HB;
};
JsonFramework.prototype.setMutableDefault = function(mutable) {
return this.root_element.setMutableDefault(mutable);
};
JsonFramework.prototype.getUserId = function() {
return this.HB.getUserId();
};
JsonFramework.prototype.toJson = function() {
return this.root_element.toJson();
};
JsonFramework.prototype.val = function(name, content, mutable) {
return this.root_element.val(name, content, mutable);
};
JsonFramework.prototype.on = function() {
var _ref;
return (_ref = this.root_element).on.apply(_ref, arguments);
};
JsonFramework.prototype.deleteListener = function() {
var _ref;
return (_ref = this.root_element).deleteListener.apply(_ref, arguments);
};
Object.defineProperty(JsonFramework.prototype, 'value', {
get: function() {
return this.root_element.value;
},
set: function(o) {
var o_name, o_obj, _results;
if (o.constructor === {}.constructor) {
_results = [];
for (o_name in o) {
o_obj = o[o_name];
_results.push(this.val(o_name, o_obj, 'immutable'));
}
return _results;
} else {
throw new Error("You must only set Object values!");
}
}
});
return JsonFramework;
})();
module.exports = JsonFramework;
if (typeof window !== "undefined" && window !== null) {
if (window.Y == null) {
window.Y = {};
}
window.Y.JsonFramework = JsonFramework;
}
}).call(this);
//# sourceMappingURL=../Frameworks/JsonFramework.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["Frameworks/JsonFramework.coffee"],"names":[],"mappings":"AACA;AAAA,MAAA,8DAAA;;AAAA,EAAA,wBAAA,GAA2B,OAAA,CAAQ,oBAAR,CAA3B,CAAA;;AAAA,EACA,aAAA,GAAgB,OAAA,CAAQ,kBAAR,CADhB,CAAA;;AAAA,EAEA,MAAA,GAAS,OAAA,CAAQ,WAAR,CAFT,CAAA;;AAAA,EAWM;AAMS,IAAA,uBAAC,OAAD,EAAU,SAAV,GAAA;AACX,UAAA,wBAAA;AAAA,MAAA,IAAC,CAAA,EAAD,GAAU,IAAA,aAAA,CAAc,OAAd,CAAV,CAAA;AAAA,MACA,YAAA,GAAe,wBAAA,CAAyB,IAAC,CAAA,EAA1B,CADf,CAAA;AAAA,MAEA,IAAC,CAAA,KAAD,GAAS,YAAY,CAAC,KAFtB,CAAA;AAAA,MAGA,IAAC,CAAA,MAAD,GAAc,IAAA,MAAA,CAAO,IAAC,CAAA,EAAR,EAAY,YAAY,CAAC,MAAzB,CAHd,CAAA;AAAA,MAIA,IAAC,CAAA,SAAD,GAAiB,IAAA,SAAA,CAAU,IAAC,CAAA,MAAX,EAAmB,IAAC,CAAA,EAApB,EAAwB,YAAY,CAAC,kBAArC,EAAyD,IAAzD,CAJjB,CAAA;AAAA,MAKA,UAAA,GAAiB,IAAA,IAAC,CAAA,KAAK,CAAC,QAAP,CAAgB,IAAC,CAAA,EAAE,CAAC,2BAAJ,CAAA,CAAhB,CALjB,CAAA;AAAA,MAMA,IAAC,CAAA,EAAE,CAAC,YAAJ,CAAiB,UAAjB,CAA4B,CAAC,OAA7B,CAAA,CANA,CAAA;AAAA,MAOA,IAAC,CAAA,YAAD,GAAgB,UAPhB,CADW;IAAA,CAAb;;AAAA,4BAaA,eAAA,GAAiB,SAAA,GAAA;aACf,IAAC,CAAA,aADc;IAAA,CAbjB,CA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KAAiB,EAAE,CAAC,WAAvB;AACE;eAAA,WAAA;8BAAA;AACE,0BAAA,IAAC,CAAA,GAAD,CAAK,MAAL,EAAa,KAAb,EAAoB,WAApB,EAAA,CADF;AAAA;0BADF;SAAA,MAAA;AAIE,gBAAU,IAAA,KAAA,CAAM,kCAAN,CAAV,CAJF;SADI;MAAA,CADN;KADF,CArEA,CAAA;;yBAAA;;MAjBF,CAAA;;AAAA,EA+FA,MAAM,CAAC,OAAP,GAAiB,aA/FjB,CAAA;;AAgGA,EAAA,IAAG,gDAAH;AACE,IAAA,IAAO,gBAAP;AACE,MAAA,MAAM,CAAC,CAAP,GAAW,EAAX,CADF;KAAA;AAAA,IAEA,MAAM,CAAC,CAAC,CAAC,aAAT,GAAyB,aAFzB,CADF;GAhGA;AAAA","file":"Frameworks/JsonFramework.js","sourceRoot":"/source/","sourcesContent":["\njson_types_uninitialized = require \"../Types/JsonTypes\"\nHistoryBuffer = require \"../HistoryBuffer\"\nEngine = require \"../Engine\"\n\n#\n# Framework for Json data-structures.\n# Known values that are supported:\n# * String\n# * Integer\n# * Array\n#\nclass JsonFramework\n\n #\n # @param {String} user_id Unique id of the peer.\n # @param {Connector} Connector the connector class.\n #\n constructor: (user_id, Connector)->\n @HB = new HistoryBuffer user_id\n type_manager = json_types_uninitialized @HB\n @types = type_manager.types\n @engine = new Engine @HB, type_manager.parser\n @connector = new Connector @engine, @HB, type_manager.execution_listener, @\n first_word = new @types.JsonType @HB.getReservedUniqueIdentifier()\n @HB.addOperation(first_word).execute()\n @root_element = first_word\n\n #\n # @return JsonType\n #\n getSharedObject: ()->\n @root_element\n\n #\n # Get the initialized connector.\n #\n getConnector: ()->\n @connector\n\n #\n # @see HistoryBuffer\n #\n getHistoryBuffer: ()->\n @HB\n\n #\n # @see JsonType.setMutableDefault\n #\n setMutableDefault: (mutable)->\n @root_element.setMutableDefault(mutable)\n\n #\n # Get the UserId from the HistoryBuffer object.\n # In most cases this will be the same as the user_id value with which\n # JsonFramework was initialized (Depending on the HistoryBuffer implementation).\n #\n getUserId: ()->\n @HB.getUserId()\n\n #\n # @see JsonType.toJson\n #\n toJson : ()->\n @root_element.toJson()\n\n #\n # @see JsonType.val\n #\n val : (name, content, mutable)->\n @root_element.val(name, content, mutable)\n\n #\n # @see Operation.on\n #\n on: ()->\n @root_element.on arguments...\n\n #\n # @see Operation.deleteListener\n #\n deleteListener: ()->\n @root_element.deleteListener arguments...\n\n #\n # @see JsonType.value\n #\n Object.defineProperty JsonFramework.prototype, 'value',\n get : -> @root_element.value\n set : (o)->\n if o.constructor is {}.constructor\n for o_name,o_obj of o\n @val(o_name, o_obj, 'immutable')\n else\n throw new Error \"You must only set Object values!\"\n\nmodule.exports = JsonFramework\nif window?\n if not window.Y?\n window.Y = {}\n window.Y.JsonFramework = JsonFramework\n"]}

View File

@@ -1,85 +0,0 @@
json_types_uninitialized = require "../Types/JsonTypes"
HistoryBuffer = require "../HistoryBuffer"
Engine = require "../Engine"
#
# Framework for Json data-structures.
# Known values that are supported:
# * String
# * Integer
# * Array
#
class JsonYatta
#
# @param {String} user_id Unique id of the peer.
# @param {Connector} Connector the connector class.
#
constructor: (user_id, Connector)->
@HB = new HistoryBuffer user_id
json_types = json_types_uninitialized @HB
@engine = new Engine @HB, json_types.parser
@connector = new Connector @engine, @HB, json_types.execution_listener, @
first_word = new json_types.types.JsonType @HB.getReservedUniqueIdentifier()
@HB.addOperation(first_word).execute()
@root_element = first_word
#
# @result JsonType
#
getSharedObject: ()->
@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()
#
# @see JsonType.val
#
val : (name, content, mutable)->
@root_element.val(name, content, mutable)
#
# @see JsonType.value
#
Object.defineProperty JsonYatta.prototype, 'value',
get : -> @root_element.value
set : (o)->
if o.constructor is {}.constructor
for o_name,o_obj of o
@val(o_name, o_obj, 'immutable')
else
throw new Error "You must only set Object values!"
window?.JsonYatta = JsonYatta
module.exports = JsonYatta

View File

@@ -1,2 +0,0 @@
(function(){var t,e,n,o;o=require("../Types/JsonTypes"),e=require("../HistoryBuffer"),t=require("../Engine"),n=function(){function n(n,r){var i,s;this.HB=new e(n),s=o(this.HB),this.types=s.types,this.engine=new t(this.HB,s.parser),this.connector=new r(this.engine,this.HB,s.execution_listener,this),i=new this.types.JsonType(this.HB.getReservedUniqueIdentifier()),this.HB.addOperation(i).execute(),this.root_element=i}return n.prototype.getSharedObject=function(){return this.root_element},n.prototype.getEngine=function(){return this.engine},n.prototype.getConnector=function(){return this.connector},n.prototype.getHistoryBuffer=function(){return this.HB},n.prototype.setMutableDefault=function(t){return this.root_element.setMutableDefault(t)},n.prototype.getUserId=function(){return this.HB.getUserId()},n.prototype.toJson=function(){return this.root_element.toJson()},n.prototype.val=function(t,e,n){return this.root_element.val(t,e,n)},n.prototype.on=function(){var t;return(t=this.root_element).on.apply(t,arguments)},n.prototype.deleteListener=function(){var t;return(t=this.root_element).deleteListener.apply(t,arguments)},Object.defineProperty(n.prototype,"value",{get:function(){return this.root_element.value},set:function(t){var e,n,o;if(t.constructor==={}.constructor){o=[];for(e in t)n=t[e],o.push(this.val(e,n,"immutable"));return o}throw new Error("You must only set Object values!")}}),n}(),module.exports=n,"undefined"!=typeof window&&null!==window&&(null==window.Y&&(window.Y={}),window.Y.JsonYatta=n)}).call(this);
//# sourceMappingURL=../Frameworks/JsonYatta.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"Frameworks/JsonYatta.js","sources":["Frameworks/JsonYatta.coffee"],"names":[],"mappings":"CACA,WAAA,GAAA,GAAA,EAAA,EAAA,CAAA,GAA2B,QAAQ,sBACnC,EAAgB,QA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AO,EAAE,UAAY","sourcesContent":["\njson_types_uninitialized = require \"../Types/JsonTypes\"\nHistoryBuffer = require \"../HistoryBuffer\"\nEngine = require \"../Engine\"\n\n#\n# Framework for Json data-structures.\n# Known values that are supported:\n# * String\n# * Integer\n# * Array\n#\nclass JsonYatta\n\n #\n # @param {String} user_id Unique id of the peer.\n # @param {Connector} Connector the connector class.\n #\n constructor: (user_id, Connector)->\n @HB = new HistoryBuffer user_id\n type_manager = json_types_uninitialized @HB\n @types = type_manager.types\n @engine = new Engine @HB, type_manager.parser\n @connector = new Connector @engine, @HB, type_manager.execution_listener, @\n\n first_word = new @types.JsonType @HB.getReservedUniqueIdentifier()\n @HB.addOperation(first_word).execute()\n @root_element = first_word\n\n #\n # @result JsonType\n #\n getSharedObject: ()->\n @root_element\n\n #\n # @see Engine\n #\n getEngine: ()->\n @engine\n\n #\n # Get the initialized connector.\n #\n getConnector: ()->\n @connector\n\n #\n # @see HistoryBuffer\n #\n getHistoryBuffer: ()->\n @HB\n\n #\n # @see JsonType.setMutableDefault\n #\n setMutableDefault: (mutable)->\n @root_element.setMutableDefault(mutable)\n\n #\n # Get the UserId from the HistoryBuffer object.\n # In most cases this will be the same as the user_id value with which\n # JsonYatta was initialized (Depending on the HistoryBuffer implementation).\n #\n getUserId: ()->\n @HB.getUserId()\n\n #\n # @see JsonType.toJson\n #\n toJson : ()->\n @root_element.toJson()\n\n #\n # @see JsonType.val\n #\n val : (name, content, mutable)->\n @root_element.val(name, content, mutable)\n\n on: ()->\n @root_element.on arguments...\n\n deleteListener: ()->\n @root_element.deleteListener arguments...\n\n #\n # @see JsonType.value\n #\n Object.defineProperty JsonYatta.prototype, 'value',\n get : -> @root_element.value\n set : (o)->\n if o.constructor is {}.constructor\n for o_name,o_obj of o\n @val(o_name, o_obj, 'immutable')\n else\n throw new Error \"You must only set Object values!\"\n\nmodule.exports = JsonYatta\nif window?\n if not window.Y?\n window.Y = {}\n window.Y.JsonYatta = JsonYatta\n"],"sourceRoot":"/source/"}

View File

@@ -0,0 +1,111 @@
(function() {
var Engine, HistoryBuffer, TextFramework, text_types_uninitialized;
text_types_uninitialized = require("../Types/TextTypes");
HistoryBuffer = require("../HistoryBuffer");
Engine = require("../Engine");
TextFramework = (function() {
function TextFramework(user_id, Connector) {
var beg, beginning, end, first_word, text_types, uid_beg, uid_end, uid_r;
this.HB = new HistoryBuffer(user_id);
text_types = text_types_uninitialized(this.HB);
this.types = text_types.types;
this.engine = new Engine(this.HB, text_types.parser);
this.connector = new Connector(this.engine, this.HB, text_types.execution_listener, this);
beginning = this.HB.addOperation(new this.types.Delimiter({
creator: '_',
op_number: '_beginning'
}, void 0, void 0));
end = this.HB.addOperation(new this.types.Delimiter({
creator: '_',
op_number: '_end'
}, beginning, void 0));
beginning.next_cl = end;
beginning.execute();
end.execute();
first_word = new this.types.WordType({
creator: '_',
op_number: '_'
}, beginning, end);
this.HB.addOperation(first_word).execute();
uid_r = {
creator: '_',
op_number: "RM"
};
uid_beg = {
creator: '_',
op_number: "_RM_beginning"
};
uid_end = {
creator: '_',
op_number: "_RM_end"
};
beg = this.HB.addOperation(new this.types.Delimiter(uid_beg, void 0, uid_end)).execute();
end = this.HB.addOperation(new this.types.Delimiter(uid_end, beg, void 0)).execute();
this.root_element = this.HB.addOperation(new this.types.ReplaceManager(void 0, uid_r, beg, end)).execute();
this.root_element.replace(first_word, {
creator: '_',
op_number: 'Replaceable'
});
}
TextFramework.prototype.getSharedObject = function() {
return this.root_element.val();
};
TextFramework.prototype.getConnector = function() {
return this.connector;
};
TextFramework.prototype.getHistoryBuffer = function() {
return this.HB;
};
TextFramework.prototype.getUserId = function() {
return this.HB.getUserId();
};
TextFramework.prototype.val = function() {
return this.getSharedObject().val();
};
TextFramework.prototype.insertText = function(pos, content) {
return this.getSharedObject().insertText(pos, content);
};
TextFramework.prototype.deleteText = function(pos, length) {
return this.getSharedObject().deleteText(pos, length);
};
TextFramework.prototype.bind = function(textarea) {
return this.getSharedObject().bind(textarea);
};
TextFramework.prototype.replaceText = function(text) {
return this.getSharedObject().replaceText(text);
};
TextFramework.prototype.on = function() {
var _ref;
return (_ref = this.root_element).on.apply(_ref, arguments);
};
return TextFramework;
})();
module.exports = TextFramework;
if (typeof window !== "undefined" && window !== null) {
if (window.Y == null) {
window.Y = {};
}
window.Y.TextFramework = TextFramework;
}
}).call(this);
//# sourceMappingURL=../Frameworks/TextFramework.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,82 +0,0 @@
text_types_uninitialized = require "../Types/TextTypes"
HistoryBuffer = require "../HistoryBuffer"
Engine = require "../Engine"
#
# Framework for Text Datastructures.
#
class TextYatta
#
# @param {String} user_id Uniqe user id that defines this peer.
# @param {Connector} Connector The connector defines how you connect to the other peers.
#
constructor: (user_id, Connector)->
@HB = new HistoryBuffer user_id
text_types = text_types_uninitialized @HB
@engine = new Engine @HB, text_types.parser
@connector = new Connector @engine, @HB, text_types.execution_listener
first_word = new text_types.types.Word undefined
@HB.addOperation(first_word).execute()
@root_element = first_word
#
# @result Word
#
getSharedObject: ()->
@root_element
#
# @see Engine
#
getEngine: ()->
@engine
#
# Get the initialized connector.
#
getConnector: ()->
@connector
#
# @see HistoryBuffer
#
getHistoryBuffer: ()->
@HB
#
# 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()
#
# @see JsonType.val
#
val: ()->
@root_element.val()
#
# @see Word.insertText
#
insertText: (pos, content)->
@root_element.insertText pos, content
#
# @see Word.deleteText
#
deleteText: (pos, length)->
@root_element.deleteText pos, length
#
# @see Word.replaceText
#
replaceText: (text)->
@root_element.replaceText text
module.exports = TextYatta

View File

@@ -1,2 +0,0 @@
(function(){var e,t,n,r;r=require("../Types/TextTypes"),t=require("../HistoryBuffer"),e=require("../Engine"),n=function(){function n(n,i){var o,p,s,u,c,a,d,h;this.HB=new t(n),c=r(this.HB),this.types=c.types,this.engine=new e(this.HB,c.parser),this.connector=new i(this.engine,this.HB,c.execution_listener,this),p=this.HB.addOperation(new this.types.Delimiter({creator:"_",op_number:"_beginning"},void 0,void 0)),s=this.HB.addOperation(new this.types.Delimiter({creator:"_",op_number:"_end"},p,void 0)),p.next_cl=s,p.execute(),s.execute(),u=new this.types.Word({creator:"_",op_number:"_"},p,s),this.HB.addOperation(u).execute(),h={creator:"_",op_number:"RM"},a={creator:"_",op_number:"_RM_beginning"},d={creator:"_",op_number:"_RM_end"},o=this.HB.addOperation(new this.types.Delimiter(a,void 0,d)).execute(),s=this.HB.addOperation(new this.types.Delimiter(d,o,void 0)).execute(),this.root_element=this.HB.addOperation(new this.types.ReplaceManager(void 0,h,o,s)).execute(),this.root_element.replace(u,{creator:"_",op_number:"Replaceable"})}return n.prototype.getSharedObject=function(){return this.root_element.val()},n.prototype.getEngine=function(){return this.engine},n.prototype.getConnector=function(){return this.connector},n.prototype.getHistoryBuffer=function(){return this.HB},n.prototype.getUserId=function(){return this.HB.getUserId()},n.prototype.val=function(){return this.getSharedObject().val()},n.prototype.insertText=function(e,t){return this.getSharedObject().insertText(e,t)},n.prototype.deleteText=function(e,t){return this.getSharedObject().deleteText(e,t)},n.prototype.bind=function(e){return this.getSharedObject().bind(e)},n.prototype.replaceText=function(e){return this.getSharedObject().replaceText(e)},n.prototype.on=function(){var e;return(e=this.root_element).on.apply(e,arguments)},n}(),module.exports=n,"undefined"!=typeof window&&null!==window&&(null==window.Y&&(window.Y={}),window.Y.TextYatta=n)}).call(this);
//# sourceMappingURL=../Frameworks/TextYatta.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"Frameworks/TextYatta.js","sources":["Frameworks/TextYatta.coffee"],"names":[],"mappings":"CACA,WAAA,GAAA,GAAA,EAAA,EAAA,CAAA,GAA2B,QAAQ,sBACnC,EAAgB,QAAQ,oBACxB,EAAS,QAAQ,aAKX,EAAA,WAMS,QAAA,GAAC,EAAS,GACrB,GAAA,GAAA,EAAA,EAAA,EAAA,EAAA,EAAA,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EAAA,UAuEA,WAAY,SAAC,EAAK,SAChB,MAAC,kBAAkB,WAAW,EAAK,IAxErC,EAAA,UA6EA,KAAM,SAAC,SACL,MAAC,kBAAkB,KAAK,IA9E1B,EAAA,UAmFA,YAAa,SAAC,SACZ,MAAC,kBAAkB,YAAY,IApFjC,EAAA,UAsFA,GAAI,WACF,GAAA,UAAA,EAAA,KAAC,cAAa,GAAd,MAAA,EAAiB,iBAGrB,OAAO,QAAU,EACd,mBAAA,SAAA,OAAA,SACM,MAAA,OAAA,IACL,OAAO,MACT,OAAO,EAAE,UAAY","sourcesContent":["\ntext_types_uninitialized = require \"../Types/TextTypes\"\nHistoryBuffer = require \"../HistoryBuffer\"\nEngine = require \"../Engine\"\n\n#\n# Framework for Text Datastructures.\n#\nclass TextYatta\n\n #\n # @param {String} user_id Uniqe user id that defines this peer.\n # @param {Connector} Connector The connector defines how you connect to the other peers.\n #\n constructor: (user_id, Connector)->\n @HB = new HistoryBuffer user_id\n text_types = text_types_uninitialized @HB\n @types = text_types.types\n @engine = new Engine @HB, text_types.parser\n @connector = new Connector @engine, @HB, text_types.execution_listener, @\n\n beginning = @HB.addOperation new @types.Delimiter {creator: '_', op_number: '_beginning'} , undefined, undefined\n end = @HB.addOperation new @types.Delimiter {creator: '_', op_number: '_end'} , beginning, undefined\n beginning.next_cl = end\n beginning.execute()\n end.execute()\n first_word = new @types.Word {creator: '_', op_number: '_'}, beginning, end\n @HB.addOperation(first_word).execute()\n\n uid_r = { creator: '_', op_number: \"RM\" }\n uid_beg = { creator: '_', op_number: \"_RM_beginning\" }\n uid_end = { creator: '_', op_number: \"_RM_end\" }\n beg = @HB.addOperation(new @types.Delimiter uid_beg, undefined, uid_end).execute()\n end = @HB.addOperation(new @types.Delimiter uid_end, beg, undefined).execute()\n @root_element = @HB.addOperation(new @types.ReplaceManager undefined, uid_r, beg, end).execute()\n @root_element.replace first_word, { creator: '_', op_number: 'Replaceable'}\n\n\n #\n # @result Word\n #\n getSharedObject: ()->\n @root_element.val()\n\n #\n # @see Engine\n #\n getEngine: ()->\n @engine\n\n #\n # Get the initialized connector.\n #\n getConnector: ()->\n @connector\n\n #\n # @see HistoryBuffer\n #\n getHistoryBuffer: ()->\n @HB\n\n #\n # Get the UserId from the HistoryBuffer object.\n # In most cases this will be the same as the user_id value with which\n # JsonYatta was initialized (Depending on the HistoryBuffer implementation).\n #\n getUserId: ()->\n @HB.getUserId()\n\n #\n # @see JsonType.val\n #\n val: ()->\n @getSharedObject().val()\n\n #\n # @see Word.insertText\n #\n insertText: (pos, content)->\n @getSharedObject().insertText pos, content\n\n #\n # @see Word.deleteText\n #\n deleteText: (pos, length)->\n @getSharedObject().deleteText pos, length\n\n #\n # @see Word.bind\n #\n bind: (textarea)->\n @getSharedObject().bind textarea\n\n #\n # @see Word.replaceText\n #\n replaceText: (text)->\n @getSharedObject().replaceText text\n\n on: ()->\n @root_element.on arguments...\n\n\nmodule.exports = TextYatta\nif window?\n if not window.Y?\n window.Y = {}\n window.Y.TextYatta = TextYatta\n"],"sourceRoot":"/source/"}