added xml example

This commit is contained in:
Kevin Jahns
2016-03-14 19:45:50 +01:00
parent 51c8d3bdc6
commit 5cfe209688
6 changed files with 6035 additions and 75 deletions

8
Examples/Xml/index.html Normal file
View File

@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<body>
<script src="../bower_components/yjs/y.es6"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>
<script src="./index.js"></script>
</body>
</html>

24
Examples/Xml/index.js Normal file
View File

@@ -0,0 +1,24 @@
/* global Y */
// initialize a shared object. This function call returns a promise!
Y({
db: {
name: 'memory'
},
connector: {
name: 'websockets-client',
url: 'http://127.0.0.1:1234',
room: 'Xml-example'
},
sourceDir: '/bower_components',
share: {
xml: 'Xml("p")' // y.share.xml is of type Y.Xml with tagname "p"
}
}).then(function (y) {
window.yXml = y
// bind xml type to a dom, and put it in body
y.share.xml.getDom().then(function (dom) {
window.sharedDom = dom
document.body.appendChild(dom)
})
})