fixed error with native event listeners
This commit is contained in:
parent
e1900e8561
commit
d4bb2dc173
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
build/browser/Frameworks/XmlFramework.min.js
vendored
4
build/browser/Frameworks/XmlFramework.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -32,16 +32,6 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<h2>Class Listing A-Z</h2>
|
<h2>Class Listing A-Z</h2>
|
||||||
<div class='index'>
|
<div class='index'>
|
||||||
<ul>
|
|
||||||
<li class='letter'>i</li>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href='class/IwcConnector.html'>
|
|
||||||
IwcConnector
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li class='letter'>j</li>
|
<li class='letter'>j</li>
|
||||||
<ul>
|
<ul>
|
||||||
@ -62,16 +52,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
|
||||||
<li class='letter'>p</li>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href='class/PeerJsConnector.html'>
|
|
||||||
PeerJsConnector
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li class='letter'>t</li>
|
<li class='letter'>t</li>
|
||||||
<ul>
|
<ul>
|
||||||
@ -160,14 +140,6 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li class='letter'>i</li>
|
<li class='letter'>i</li>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
|
||||||
<a href='file/lib/ConnectorsDeprecated/IwcConnector.coffee.html'>
|
|
||||||
IwcConnector.coffee
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(lib/ConnectorsDeprecated)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='file/lib/index.coffee.html'>
|
<a href='file/lib/index.coffee.html'>
|
||||||
index.coffee
|
index.coffee
|
||||||
@ -199,19 +171,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
|
||||||
<li class='letter'>p</li>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href='file/lib/ConnectorsDeprecated/PeerJsConnector.coffee.html'>
|
|
||||||
PeerJsConnector.coffee
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(lib/ConnectorsDeprecated)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li class='letter'>s</li>
|
<li class='letter'>s</li>
|
||||||
<ul>
|
<ul>
|
||||||
@ -228,14 +187,6 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li class='letter'>t</li>
|
<li class='letter'>t</li>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
|
||||||
<a href='file/lib/ConnectorsDeprecated/TestConnector.coffee.html'>
|
|
||||||
TestConnector.coffee
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(lib/ConnectorsDeprecated)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='file/lib/Frameworks/TextFramework.coffee.html'>
|
<a href='file/lib/Frameworks/TextFramework.coffee.html'>
|
||||||
TextFramework.coffee
|
TextFramework.coffee
|
||||||
@ -271,7 +222,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -335,7 +335,7 @@ JsonFramework was initialized (Depending on the HistoryBuffer implementation).</
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -466,7 +466,7 @@ if (x.type === "JsonType") {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -139,7 +139,7 @@ console.log(w.newProperty == "Awesome") # true!</code></pre>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -356,7 +356,7 @@ JsonFramework was initialized (Depending on the HistoryBuffer implementation).</
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -455,7 +455,7 @@ yatta.bind(textbox);</code></pre>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -303,7 +303,7 @@ JsonFramework was initialized (Depending on the HistoryBuffer implementation).</
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -29,22 +29,6 @@
|
|||||||
<input type='text'>
|
<input type='text'>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
|
||||||
<a href='class/IwcConnector.html' target='main'>
|
|
||||||
IwcConnector
|
|
||||||
</a>
|
|
||||||
<small class='namespace'>
|
|
||||||
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/PeerJsConnector.html' target='main'>
|
|
||||||
PeerJsConnector
|
|
||||||
</a>
|
|
||||||
<small class='namespace'>
|
|
||||||
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/JsonFramework.html' target='main'>
|
<a href='class/JsonFramework.html' target='main'>
|
||||||
JsonFramework
|
JsonFramework
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -76,7 +76,7 @@ But I would become really motivated if you gave me some feedback :) (<a href="ht
|
|||||||
</ul>
|
</ul>
|
||||||
<h2 id="support">Support</h2><p>Please report <em>any</em> issues to the <a href="https://github.com/DadaMonad/Yatta/issues">Github issue page</a>!
|
<h2 id="support">Support</h2><p>Please report <em>any</em> issues to the <a href="https://github.com/DadaMonad/Yatta/issues">Github issue page</a>!
|
||||||
I would appreciate if developers gave me feedback on how <em>convenient</em> the framework is, and if it is easy to use. Particularly the XML-support may not support every DOM-methods - if you encounter a method that does not cause any change on other peers,
|
I would appreciate if developers gave me feedback on how <em>convenient</em> the framework is, and if it is easy to use. Particularly the XML-support may not support every DOM-methods - if you encounter a method that does not cause any change on other peers,
|
||||||
please state function name, and sample parameters. However, there are browser-specific features, that Yatta won't support.</p><h2 id="license">License</h2><p>Yatta! is licensed under the <a href="./LICENSE.txt">MIT License</a>.</p><a href="mailto:kevin.jahns@rwth-aachen.de">kevin.jahns@rwth-aachen.de</a>
|
please state function name, and sample parameters. However, there are browser-specific features, that Yatta won't support.</p><h2 id="license">License</h2><p>Yatta! is licensed under the <a href="./LICENSE.txt">MIT License</a>.</p><a href="mailto:kevin.jahns@rwth-aachen.de">kevin.jahns@rwth-aachen.de</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ please state function name, and sample parameters. However, there are browser-sp
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
November 25, 14 15:50:22 by
|
December 01, 14 10:47:17 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -43,38 +43,6 @@
|
|||||||
lib
|
lib
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<span>
|
|
||||||
ConnectorsDeprecated
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href='file/lib/ConnectorsDeprecated/IwcConnector.coffee.html' target='main'>
|
|
||||||
IwcConnector.coffee
|
|
||||||
</a>
|
|
||||||
<small class='namespace'>
|
|
||||||
lib/ConnectorsDeprecated
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='file/lib/ConnectorsDeprecated/PeerJsConnector.coffee.html' target='main'>
|
|
||||||
PeerJsConnector.coffee
|
|
||||||
</a>
|
|
||||||
<small class='namespace'>
|
|
||||||
lib/ConnectorsDeprecated
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='file/lib/ConnectorsDeprecated/TestConnector.coffee.html' target='main'>
|
|
||||||
TestConnector.coffee
|
|
||||||
</a>
|
|
||||||
<small class='namespace'>
|
|
||||||
lib/ConnectorsDeprecated
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href='file/lib/Engine.coffee.html' target='main'>
|
<a href='file/lib/Engine.coffee.html' target='main'>
|
||||||
Engine.coffee
|
Engine.coffee
|
||||||
|
File diff suppressed because one or more lines are too long
@ -53,14 +53,6 @@
|
|||||||
(lib/ConnectorAdapter.coffee)
|
(lib/ConnectorAdapter.coffee)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/PeerJsConnector.html#addConnection-dynamic' target='main' title='addConnection'>
|
|
||||||
#addConnection
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(PeerJsConnector)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/WordType.html#applyDelete-dynamic' target='main' title='applyDelete'>
|
<a href='class/WordType.html#applyDelete-dynamic' target='main' title='applyDelete'>
|
||||||
#applyDelete
|
#applyDelete
|
||||||
@ -77,14 +69,6 @@
|
|||||||
(JsonType)
|
(JsonType)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/WordType.html#bind-dynamic' target='main' title='bind'>
|
|
||||||
#bind
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(WordType)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/TextFramework.html#bind-dynamic' target='main' title='bind'>
|
<a href='class/TextFramework.html#bind-dynamic' target='main' title='bind'>
|
||||||
#bind
|
#bind
|
||||||
@ -94,8 +78,8 @@
|
|||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/WordType.html#cleanup-dynamic' target='main' title='cleanup'>
|
<a href='class/WordType.html#bind-dynamic' target='main' title='bind'>
|
||||||
#cleanup
|
#bind
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
(WordType)
|
(WordType)
|
||||||
@ -110,53 +94,13 @@
|
|||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/PeerJsConnector.html#connectToPeer-dynamic' target='main' title='connectToPeer'>
|
<a href='class/WordType.html#cleanup-dynamic' target='main' title='cleanup'>
|
||||||
#connectToPeer
|
#cleanup
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(PeerJsConnector)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/XmlFramework.html#constructor-dynamic' target='main' title='constructor'>
|
|
||||||
#constructor
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(XmlFramework)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/IwcConnector.html#constructor-dynamic' target='main' title='constructor'>
|
|
||||||
#constructor
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(IwcConnector)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/JsonFramework.html#constructor-dynamic' target='main' title='constructor'>
|
|
||||||
#constructor
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(JsonFramework)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/WordType.html#constructor-dynamic' target='main' title='constructor'>
|
|
||||||
#constructor
|
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
(WordType)
|
(WordType)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/JsonType.html#constructor-dynamic' target='main' title='constructor'>
|
|
||||||
#constructor
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(JsonType)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/JsonTypeWrapper.html#constructor-dynamic' target='main' title='constructor'>
|
<a href='class/JsonTypeWrapper.html#constructor-dynamic' target='main' title='constructor'>
|
||||||
#constructor
|
#constructor
|
||||||
@ -165,14 +109,6 @@
|
|||||||
(JsonTypeWrapper)
|
(JsonTypeWrapper)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/PeerJsConnector.html#constructor-dynamic' target='main' title='constructor'>
|
|
||||||
#constructor
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(PeerJsConnector)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/TextFramework.html#constructor-dynamic' target='main' title='constructor'>
|
<a href='class/TextFramework.html#constructor-dynamic' target='main' title='constructor'>
|
||||||
#constructor
|
#constructor
|
||||||
@ -182,19 +118,35 @@
|
|||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='file/lib/ConnectorsDeprecated/IwcConnector.coffee.html#createIwcConnector-' target='main' title='createIwcConnector'>
|
<a href='class/WordType.html#constructor-dynamic' target='main' title='constructor'>
|
||||||
~createIwcConnector
|
#constructor
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
(lib/ConnectorsDeprecated/IwcConnector.coffee)
|
(WordType)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='file/lib/ConnectorsDeprecated/PeerJsConnector.coffee.html#createPeerJsConnector-' target='main' title='createPeerJsConnector'>
|
<a href='class/XmlFramework.html#constructor-dynamic' target='main' title='constructor'>
|
||||||
~createPeerJsConnector
|
#constructor
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
(lib/ConnectorsDeprecated/PeerJsConnector.coffee)
|
(XmlFramework)
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href='class/JsonType.html#constructor-dynamic' target='main' title='constructor'>
|
||||||
|
#constructor
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
(JsonType)
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href='class/JsonFramework.html#constructor-dynamic' target='main' title='constructor'>
|
||||||
|
#constructor
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
(JsonFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -205,14 +157,6 @@
|
|||||||
(JsonFramework)
|
(JsonFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/WordType.html#deleteText-dynamic' target='main' title='deleteText'>
|
|
||||||
#deleteText
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(WordType)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/TextFramework.html#deleteText-dynamic' target='main' title='deleteText'>
|
<a href='class/TextFramework.html#deleteText-dynamic' target='main' title='deleteText'>
|
||||||
#deleteText
|
#deleteText
|
||||||
@ -222,11 +166,19 @@
|
|||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/PeerJsConnector.html#getAllConnectionIds-dynamic' target='main' title='getAllConnectionIds'>
|
<a href='class/WordType.html#deleteText-dynamic' target='main' title='deleteText'>
|
||||||
#getAllConnectionIds
|
#deleteText
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
(PeerJsConnector)
|
(WordType)
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href='class/XmlFramework.html#getConnector-dynamic' target='main' title='getConnector'>
|
||||||
|
#getConnector
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
(XmlFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -245,14 +197,6 @@
|
|||||||
(JsonFramework)
|
(JsonFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/XmlFramework.html#getConnector-dynamic' target='main' title='getConnector'>
|
|
||||||
#getConnector
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(XmlFramework)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/XmlFramework.html#getHistoryBuffer-dynamic' target='main' title='getHistoryBuffer'>
|
<a href='class/XmlFramework.html#getHistoryBuffer-dynamic' target='main' title='getHistoryBuffer'>
|
||||||
#getHistoryBuffer
|
#getHistoryBuffer
|
||||||
@ -285,6 +229,14 @@
|
|||||||
(JsonType)
|
(JsonType)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href='class/JsonFramework.html#getSharedObject-dynamic' target='main' title='getSharedObject'>
|
||||||
|
#getSharedObject
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
(JsonFramework)
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/XmlFramework.html#getSharedObject-dynamic' target='main' title='getSharedObject'>
|
<a href='class/XmlFramework.html#getSharedObject-dynamic' target='main' title='getSharedObject'>
|
||||||
#getSharedObject
|
#getSharedObject
|
||||||
@ -302,11 +254,11 @@
|
|||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/JsonFramework.html#getSharedObject-dynamic' target='main' title='getSharedObject'>
|
<a href='class/XmlFramework.html#getUserId-dynamic' target='main' title='getUserId'>
|
||||||
#getSharedObject
|
#getUserId
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
(JsonFramework)
|
(XmlFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -325,14 +277,6 @@
|
|||||||
(TextFramework)
|
(TextFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/XmlFramework.html#getUserId-dynamic' target='main' title='getUserId'>
|
|
||||||
#getUserId
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(XmlFramework)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/WordType.html#insertAfter-dynamic' target='main' title='insertAfter'>
|
<a href='class/WordType.html#insertAfter-dynamic' target='main' title='insertAfter'>
|
||||||
#insertAfter
|
#insertAfter
|
||||||
@ -357,6 +301,14 @@
|
|||||||
(TextFramework)
|
(TextFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href='class/JsonFramework.html#on-dynamic' target='main' title='on'>
|
||||||
|
#on
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
(JsonFramework)
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/XmlFramework.html#on-dynamic' target='main' title='on'>
|
<a href='class/XmlFramework.html#on-dynamic' target='main' title='on'>
|
||||||
#on
|
#on
|
||||||
@ -373,22 +325,6 @@
|
|||||||
(TextFramework)
|
(TextFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/JsonFramework.html#on-dynamic' target='main' title='on'>
|
|
||||||
#on
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(JsonFramework)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/PeerJsConnector.html#onNewConnection-dynamic' target='main' title='onNewConnection'>
|
|
||||||
#onNewConnection
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(PeerJsConnector)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/WordType.html#push-dynamic' target='main' title='push'>
|
<a href='class/WordType.html#push-dynamic' target='main' title='push'>
|
||||||
#push
|
#push
|
||||||
@ -397,22 +333,6 @@
|
|||||||
(WordType)
|
(WordType)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/IwcConnector.html#receive-dynamic' target='main' title='receive'>
|
|
||||||
#receive
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(IwcConnector)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/WordType.html#replaceText-dynamic' target='main' title='replaceText'>
|
|
||||||
#replaceText
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(WordType)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href='class/TextFramework.html#replaceText-dynamic' target='main' title='replaceText'>
|
<a href='class/TextFramework.html#replaceText-dynamic' target='main' title='replaceText'>
|
||||||
#replaceText
|
#replaceText
|
||||||
@ -422,43 +342,11 @@
|
|||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/IwcConnector.html#send-dynamic' target='main' title='send'>
|
<a href='class/WordType.html#replaceText-dynamic' target='main' title='replaceText'>
|
||||||
#send
|
#replaceText
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
(IwcConnector)
|
(WordType)
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/IwcConnector.html#sendIwcIntent-dynamic' target='main' title='sendIwcIntent'>
|
|
||||||
#sendIwcIntent
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(IwcConnector)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/IwcConnector.html#setIwcHandler-dynamic' target='main' title='setIwcHandler'>
|
|
||||||
#setIwcHandler
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(IwcConnector)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/XmlFramework.html#setMutableDefault-dynamic' target='main' title='setMutableDefault'>
|
|
||||||
#setMutableDefault
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(XmlFramework)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/JsonType.html#setMutableDefault-dynamic' target='main' title='setMutableDefault'>
|
|
||||||
#setMutableDefault
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(JsonType)
|
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -470,11 +358,19 @@
|
|||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/WordType.html#setReplaceManager-dynamic' target='main' title='setReplaceManager'>
|
<a href='class/JsonType.html#setMutableDefault-dynamic' target='main' title='setMutableDefault'>
|
||||||
#setReplaceManager
|
#setMutableDefault
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
(WordType)
|
(JsonType)
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href='class/XmlFramework.html#setMutableDefault-dynamic' target='main' title='setMutableDefault'>
|
||||||
|
#setMutableDefault
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
(XmlFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -485,6 +381,14 @@
|
|||||||
(JsonType)
|
(JsonType)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href='class/WordType.html#setReplaceManager-dynamic' target='main' title='setReplaceManager'>
|
||||||
|
#setReplaceManager
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
(WordType)
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/JsonFramework.html#toJson-dynamic' target='main' title='toJson'>
|
<a href='class/JsonFramework.html#toJson-dynamic' target='main' title='toJson'>
|
||||||
#toJson
|
#toJson
|
||||||
@ -518,19 +422,11 @@
|
|||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/TextFramework.html#val-dynamic' target='main' title='val'>
|
<a href='class/JsonFramework.html#val-dynamic' target='main' title='val'>
|
||||||
#val
|
#val
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
(TextFramework)
|
(JsonFramework)
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href='class/WordType.html#val-dynamic' target='main' title='val'>
|
|
||||||
#val
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(WordType)
|
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -541,6 +437,22 @@
|
|||||||
(XmlFramework)
|
(XmlFramework)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href='class/WordType.html#val-dynamic' target='main' title='val'>
|
||||||
|
#val
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
(WordType)
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href='class/TextFramework.html#val-dynamic' target='main' title='val'>
|
||||||
|
#val
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
(TextFramework)
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='class/JsonType.html#val-dynamic' target='main' title='val'>
|
<a href='class/JsonType.html#val-dynamic' target='main' title='val'>
|
||||||
#val
|
#val
|
||||||
@ -549,14 +461,6 @@
|
|||||||
(JsonType)
|
(JsonType)
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href='class/JsonFramework.html#val-dynamic' target='main' title='val'>
|
|
||||||
#val
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
(JsonFramework)
|
|
||||||
</small>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,334 +0,0 @@
|
|||||||
## PeerJs + JSON Example
|
|
||||||
Here, I will give a short overview on how to enable collaborative json with the
|
|
||||||
[PeerJs](http://peerjs.com/) Connector and the Json Framework. Open
|
|
||||||
[index.html](http://dadamonad.github.io/Yatta/examples/PeerJs-Json/index.html) in your Browser and
|
|
||||||
use the console to explore Yatta!
|
|
||||||
|
|
||||||
[PeerJs](http://peerjs.com) is a Framework that enables you to connect to other peers. You just need the
|
|
||||||
user-id of the peer (browser/client). And then you can connect to it.
|
|
||||||
|
|
||||||
First you have to include the following libraries in your html file:
|
|
||||||
```
|
|
||||||
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
|
|
||||||
<script src="../../build/browser/Frameworks/JsonFramework.js"></script>
|
|
||||||
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
|
|
||||||
<script src="./index.js"></script>
|
|
||||||
```
|
|
||||||
### Create Connector
|
|
||||||
|
|
||||||
The PeerJs Framework requires an API key, or you need to set up your own PeerJs server.
|
|
||||||
Get an API key from the [Website](http://peerjs.com/peerserver).
|
|
||||||
The first parameter of `createPeerJsConnector` is forwarded as the options object in PeerJs.
|
|
||||||
Therefore, you may also specify the server/port here, if you have set up your own server.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
var yatta, yattaHandler;
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
This will connect to the server owned by the peerjs team.
|
|
||||||
For now, you can use my API key.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
// var conn = {key: 'h7nlefbgavh1tt9'};
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
This will connect to one of my peerjs instances.
|
|
||||||
I can't guaranty that this will be always up. This is why you should use the previous method with the api key,
|
|
||||||
or set up your own server.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
var conn = {
|
|
||||||
host: "terrific-peerjs.herokuapp.com",
|
|
||||||
port: "", // this works because heroku can forward to the right port.
|
|
||||||
// debug: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
Y.createPeerJsConnector(conn, function(Connector, user_id){
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
You can also specify your own user_id with peerjs.
|
|
||||||
But then you have to make sure that no other client associated to your API-key has the same user_id.
|
|
||||||
```
|
|
||||||
Y.createPeerJsConnector("unique_id", conn, function(Connector, user_id){
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Yatta
|
|
||||||
yatta is the shared json object. If you change something on this object,
|
|
||||||
it will be instantly shared with all the other collaborators.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta = new Y.JsonFramework(user_id, Connector);
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Next, you may want to connect to another peer. Therefore you have to receive his
|
|
||||||
user_id. If the other peer is connected to other peers, the PeerJsConnector
|
|
||||||
will automatically connect to them too.
|
|
||||||
|
|
||||||
Transmitting the user_id is your job.
|
|
||||||
See [TextEditing](../../examples/TextEditing/) for a nice example
|
|
||||||
on how to do that with urls.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
console.log("Copy your user-id: " + user_id);
|
|
||||||
|
|
||||||
// yatta.connector.connectToPeer(peer_user_id);
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Add a integer-property like this
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.val('x', 7);
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Get the value of property x like this
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
console.log(yatta.val('x') === 7); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
A string property can be either mutable or immutable.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.val('mutable_string', "text", "mutable");
|
|
||||||
yatta.val('immutable_string', "text", "immutable");
|
|
||||||
|
|
||||||
console.log(yatta.val('immutable_string') === "text"); // true
|
|
||||||
yatta.val('mutable_string').insertText(2,"XXX"); // position, string
|
|
||||||
yatta.val('mutable_string').deleteText(0,1); // position, deletion length
|
|
||||||
console.log(yatta.val('mutable_string').val() === "eXXXxt"); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Did you recognize that we use anoter `.val()` for mutable strings?
|
|
||||||
Thats because `yatta.val('mutable_string')` is of type *WordType*.
|
|
||||||
Since WordType implements `toString`, you can use it like a string:
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
console.log("" + yatta.val("mutable_string") === "eXXXxt") // true, concatenating it with a string will implicitly invoke toString()
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
You can omit the mutable - parameter. In that case the default will be used.
|
|
||||||
Initially the default is 'mutable'. You can set it like this:
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.setMutableDefault('mutable');
|
|
||||||
// or
|
|
||||||
yatta.setMutableDefault('immutable');
|
|
||||||
|
|
||||||
yatta.val('new_string', "string");
|
|
||||||
console.log(yatta.val('new_string') === "string"); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Yatta is [chainable](http://schier.co/post/method-chaining-in-javascript):
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.val('a', 4).val('b',5);
|
|
||||||
console.log(yatta.val('a') === 4); // true
|
|
||||||
console.log(yatta.val('b') === 5); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
You can alse set objects.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.val('object', {a : {b : "b"}, c : { d : 5 }});
|
|
||||||
console.log(yatta.val('object').val('c').val('d') === 5); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Lists are always immutable.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.val('list', [0,1,2]);
|
|
||||||
console.log(yatta.val('list')[2] === 2); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Check Types
|
|
||||||
Certainly you want to check types!
|
|
||||||
You get the type of an YattaType with the `.type` property.
|
|
||||||
|
|
||||||
Here, we create a function that parses a Yatta type to a string.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
function show(o){
|
|
||||||
if (o.type === "JsonType"){
|
|
||||||
return JSON.stringify(o.toJson());
|
|
||||||
} else if (o.type === "WordType") {
|
|
||||||
return o.val();
|
|
||||||
} else if (o.constructor === {}.constructor) { // It's an Object
|
|
||||||
return JSON.stringify(o);
|
|
||||||
} else { // It's a primitive data type (E.g. string, int)
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Add listeners
|
|
||||||
Apply a 'addProperty' - listener to a JsonType.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
function addProperty(event_name, property_name, op){
|
|
||||||
// op is the operation that changed the objects value. In addProperty it is most likely to be a 'Replaceable' (see doc).
|
|
||||||
console.log("Property '" + property_name + "' was created by '"+op.creator+"'!");
|
|
||||||
console.log("Value: " + show(this.val(property_name))); // 'this' is the object on which the property was created.
|
|
||||||
};
|
|
||||||
yatta.on('addProperty', addProperty);
|
|
||||||
yatta.val('new', {z: 7}); // Property 'new' was created!
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Apply a 'change' - listener to a JsonType.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
function change(event_name, property_name, op){
|
|
||||||
// Check who made this property change!
|
|
||||||
if(op.creator == yatta.getUserId()){
|
|
||||||
console.log("You changed the value of property '" + property_name + "'!");
|
|
||||||
}else{
|
|
||||||
console.log("User '"+op.creator+"' changed the value of property '" + property_name + "'!");
|
|
||||||
}
|
|
||||||
console.log("New value: " + show(this.val(property_name)) + ""); // 'this' is the object on which the property changed.
|
|
||||||
};
|
|
||||||
yatta.on('change', change);
|
|
||||||
yatta.val('mutable_string', "text", 'mutable'); // You changed the value of property 'mutable_string'!
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
'change' and 'addProperty' do also fire for nested properties.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.val('new').val('z', {'replace' : "x"}); // Property 'z' was replaced or changed!
|
|
||||||
yatta.val('new').val('z').val('new', {"true": true}); // Property 'z' was replaced or changed! + Property 'new' was created!
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Apply 'insert' and 'delete' - listeners to Words.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
function insert_delete(event_name, op){
|
|
||||||
if (event_name === "insert"){
|
|
||||||
console.log("Inserted '" + op.content + "' at position " + op.getPosition());
|
|
||||||
} else if (event_name === "delete"){
|
|
||||||
console.log("Deleted character at position " + op.getPosition());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
yatta.val('mutable_string').on(['insert', 'delete'], insert_delete);
|
|
||||||
yatta.val('mutable_string').insertText(0, 'a'); // Inserted 'a' at position 0
|
|
||||||
yatta.val('mutable_string').deleteText(0, 1); // Deleted character at position 0
|
|
||||||
|
|
||||||
yatta.deleteListener('addProperty', addProperty);
|
|
||||||
yatta.deleteListener('change', change);
|
|
||||||
yatta.val('mutable_string').deleteListener('insert_delete', insert_delete);
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Experimental method
|
|
||||||
Nah.. this is only for the cool kids.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
console.log(yatta.value.list[2] === 2) // true
|
|
||||||
yatta.value.list = [3,4,5]
|
|
||||||
console.log(yatta.val('list')[2] === 5) // true
|
|
||||||
yatta.value.object = {c : 4}
|
|
||||||
console.log(yatta.value.object.c === 4) // true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
How did I do that? ^^
|
|
||||||
|
|
||||||
In Javascript it is possible set setter- and getter- for properties. This is
|
|
||||||
why this method feels much more natural.
|
|
||||||
The downside is that you are only allowed to overwrite existing properties.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.value.newProperty = "Awesome"
|
|
||||||
console.log(yatta.value.newProperty !== "Awesome") // true, yatta.value.newProperty is undefined.
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
So, how do we create new properties?
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.value = {newProperty : "Awesome"}
|
|
||||||
console.log(yatta.value.newProperty === "Awesome") // true, it's awesome ;)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
This is stupid! I don't want to overwrite all my existing properties!
|
|
||||||
Very well.. The solution is that we merge yatta.value with the new assignment.
|
|
||||||
For example: assuming we want to overwrite yatta.value with some object o.
|
|
||||||
Then these two rules apply:
|
|
||||||
* The result has all properties of o
|
|
||||||
* The result has all properties of yatta.value if they don't occur under the same property-name in o
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.value = {newProperty : {Awesome : true }}
|
|
||||||
console.log(yatta.value.list[2] === 5) // true, old value list still exists.
|
|
||||||
console.log(yatta.value.newProperty.Awesome === true) // true, newProperty is overwritten.
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Consider this case.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
yatta.value = {newProperty : { x : 4} }
|
|
||||||
console.log(yatta.value.newProperty.Awesome == null) // true, newProperty was replaced, therefore it is now undefined
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Did you notice that you always set immutable objects if you set properties like this?
|
|
||||||
Even if the default is 'mutable'. If you want to work with mutable objects you have to work with .val().
|
|
||||||
|
|
||||||
One last thing. You are only allowed to set properties like this `yatta.value = o`.
|
|
||||||
Yatta can't observe if you overwrite object references `yatta = "Awesome"`.
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
w = yatta.value.newProperty
|
|
||||||
w = "Awesome"
|
|
||||||
console.log(yatta.value.newProperty !== "Awesome") // true, still not awesome..
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Please also read [JsonWrapper](https://rawgit.com/DadaMonad/Yatta/master/doc/class/JsonWrapper.html).
|
|
||||||
I really want to hear what you think about this method :)
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
});
|
|
||||||
```
|
|
@ -5,7 +5,7 @@
|
|||||||
<title>PeerJs Json Example</title>
|
<title>PeerJs Json Example</title>
|
||||||
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
|
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
|
||||||
<script src="../../build/browser/Frameworks/JsonFramework.js"></script>
|
<script src="../../build/browser/Frameworks/JsonFramework.js"></script>
|
||||||
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
|
<script src="../../bower_components/connector/peerjs-connector/peerjs-connector.js"></script>
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -29,35 +29,29 @@ var yatta, yattaHandler;
|
|||||||
This will connect to the server owned by the peerjs team.
|
This will connect to the server owned by the peerjs team.
|
||||||
For now, you can use my API key.
|
For now, you can use my API key.
|
||||||
*/
|
*/
|
||||||
// var conn = {key: 'h7nlefbgavh1tt9'};
|
var options = {key: 'h7nlefbgavh1tt9'};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This will connect to one of my peerjs instances.
|
This will connect to one of my peerjs instances.
|
||||||
I can't guaranty that this will be always up. This is why you should use the previous method with the api key,
|
I can't guaranty that this will be always up. This is why you should use the previous method with the api key,
|
||||||
or set up your own server.
|
or set up your own server.
|
||||||
*/
|
*/
|
||||||
var conn = {
|
/*
|
||||||
|
var options = {
|
||||||
host: "terrific-peerjs.herokuapp.com",
|
host: "terrific-peerjs.herokuapp.com",
|
||||||
port: "", // this works because heroku can forward to the right port.
|
port: "", // this works because heroku can forward to the right port.
|
||||||
// debug: true,
|
// debug: true,
|
||||||
};
|
};*/
|
||||||
|
|
||||||
Y.createPeerJsConnector(conn, function(Connector, user_id){
|
var user_id = Math.ceil(Math.random()*100);
|
||||||
|
connector = new PeerJsConnector(user_id,options);
|
||||||
/**
|
|
||||||
You can also specify your own user_id with peerjs.
|
|
||||||
But then you have to make sure that no other client associated to your API-key has the same user_id.
|
|
||||||
```
|
|
||||||
Y.createPeerJsConnector("unique_id", conn, function(Connector, user_id){
|
|
||||||
```
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
### Yatta
|
### Yatta
|
||||||
yatta is the shared json object. If you change something on this object,
|
yatta is the shared json object. If you change something on this object,
|
||||||
it will be instantly shared with all the other collaborators.
|
it will be instantly shared with all the other collaborators.
|
||||||
*/
|
*/
|
||||||
yatta = new Y.JsonFramework(user_id, Connector);
|
yatta = new Y.JsonFramework(user_id, connector);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Next, you may want to connect to another peer. Therefore you have to receive his
|
Next, you may want to connect to another peer. Therefore you have to receive his
|
||||||
@ -166,10 +160,14 @@ Y.createPeerJsConnector("unique_id", conn, function(Connector, user_id){
|
|||||||
*/
|
*/
|
||||||
function change(event_name, property_name, op){
|
function change(event_name, property_name, op){
|
||||||
// Check who made this property change!
|
// Check who made this property change!
|
||||||
if(op.creator == yatta.getUserId()){
|
if(op != null){
|
||||||
console.log("You changed the value of property '" + property_name + "'!");
|
if(op.creator == yatta.getUserId()){
|
||||||
}else{
|
console.log("You changed the value of property '" + property_name + "'!");
|
||||||
console.log("User '"+op.creator+"' changed the value of property '" + property_name + "'!");
|
}else{
|
||||||
|
console.log("User '"+op.creator+"' changed the value of property '" + property_name + "'!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("The value of property '"+property_name+"' changed!")
|
||||||
}
|
}
|
||||||
console.log("New value: " + show(this.val(property_name)) + ""); // 'this' is the object on which the property changed.
|
console.log("New value: " + show(this.val(property_name)) + ""); // 'this' is the object on which the property changed.
|
||||||
};
|
};
|
||||||
@ -260,4 +258,3 @@ Y.createPeerJsConnector("unique_id", conn, function(Connector, user_id){
|
|||||||
Please also read [JsonWrapper](https://rawgit.com/DadaMonad/Yatta/master/doc/class/JsonWrapper.html).
|
Please also read [JsonWrapper](https://rawgit.com/DadaMonad/Yatta/master/doc/class/JsonWrapper.html).
|
||||||
I really want to hear what you think about this method :)
|
I really want to hear what you think about this method :)
|
||||||
*/
|
*/
|
||||||
});
|
|
||||||
|
@ -68,6 +68,14 @@ module.exports = (HB)->
|
|||||||
if @event_listeners?[e]?
|
if @event_listeners?[e]?
|
||||||
@event_listeners[e] = @event_listeners[e].filter (g)->
|
@event_listeners[e] = @event_listeners[e].filter (g)->
|
||||||
f isnt g
|
f isnt g
|
||||||
|
|
||||||
|
#
|
||||||
|
# Deletes all subscribed event listeners.
|
||||||
|
# This should be called, e.g. after this has been replaced.
|
||||||
|
# (Then only one replace event should fire. )
|
||||||
|
# This is also called in the cleanup method.
|
||||||
|
deleteAllListeners: ()->
|
||||||
|
@event_listeners = []
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fire an event.
|
# Fire an event.
|
||||||
@ -98,6 +106,7 @@ module.exports = (HB)->
|
|||||||
cleanup: ()->
|
cleanup: ()->
|
||||||
#console.log "cleanup: #{@type}"
|
#console.log "cleanup: #{@type}"
|
||||||
HB.removeOperation @
|
HB.removeOperation @
|
||||||
|
@deleteAllListeners()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set the parent of this operation.
|
# Set the parent of this operation.
|
||||||
|
@ -128,25 +128,28 @@ module.exports = (HB)->
|
|||||||
|
|
||||||
cleanup: ()->
|
cleanup: ()->
|
||||||
super()
|
super()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Transform this to a Json and loose all the sharing-abilities (the new object will be a deep clone)!
|
# Transform this to a Json and loose all the sharing-abilities (the new object will be a deep clone)!
|
||||||
# @return {Json}
|
# @return {Json}
|
||||||
#
|
#
|
||||||
toJson: ()->
|
toJson: ()->
|
||||||
val = @val()
|
if not @bound_json?
|
||||||
json = {}
|
val = @val()
|
||||||
for name, o of val
|
json = {}
|
||||||
if o is null
|
for name, o of val
|
||||||
json[name] = o
|
if o is null
|
||||||
else if o.constructor is {}.constructor
|
json[name] = o
|
||||||
json[name] = @val(name).toJson()
|
else if o.constructor is {}.constructor
|
||||||
else if o instanceof types.Operation
|
json[name] = @val(name).toJson()
|
||||||
while o instanceof types.Operation
|
else if o instanceof types.Operation
|
||||||
o = o.val()
|
while o instanceof types.Operation
|
||||||
json[name] = o
|
o = o.val()
|
||||||
else
|
json[name] = o
|
||||||
json[name] = o
|
else
|
||||||
json
|
json[name] = o
|
||||||
|
@bound_json = json
|
||||||
|
@bound_json
|
||||||
|
|
||||||
#
|
#
|
||||||
# @see WordType.setReplaceManager
|
# @see WordType.setReplaceManager
|
||||||
|
@ -257,7 +257,7 @@ module.exports = (HB)->
|
|||||||
repl_manager.parent.callEvent 'change', property_name, op
|
repl_manager.parent.callEvent 'change', property_name, op
|
||||||
# Call this, when the first element is inserted. Then delete the listener.
|
# Call this, when the first element is inserted. Then delete the listener.
|
||||||
addPropertyListener = (event, op)->
|
addPropertyListener = (event, op)->
|
||||||
repl_manager.deleteListener 'addProperty', addPropertyListener
|
repl_manager.deleteListener 'insert', addPropertyListener
|
||||||
repl_manager.parent.callEvent 'addProperty', property_name, op
|
repl_manager.parent.callEvent 'addProperty', property_name, op
|
||||||
@on 'insert', addPropertyListener
|
@on 'insert', addPropertyListener
|
||||||
super parent
|
super parent
|
||||||
@ -338,6 +338,8 @@ module.exports = (HB)->
|
|||||||
|
|
||||||
applyDelete: ()->
|
applyDelete: ()->
|
||||||
if @content?
|
if @content?
|
||||||
|
if @next_cl.type isnt "Delimiter"
|
||||||
|
@content.deleteAllListeners()
|
||||||
@content.applyDelete()
|
@content.applyDelete()
|
||||||
@content.dontSync()
|
@content.dontSync()
|
||||||
@content = null
|
@content = null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user