updated examples
This commit is contained in:
		
							parent
							
								
									8a5b69e86c
								
							
						
					
					
						commit
						4d926cf841
					
				@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "yjs",
 | 
			
		||||
  "version": "0.4.1",
 | 
			
		||||
  "version": "0.5.0",
 | 
			
		||||
  "homepage": "https://github.com/DadaMonad/yjs",
 | 
			
		||||
  "authors": [
 | 
			
		||||
    "Kevin Jahns <kevin.jahns@rwth-aachen.de>"
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -38,10 +38,12 @@ module.exports = {
 | 
			
		||||
    this.connections = {};
 | 
			
		||||
    this.current_sync_target = null;
 | 
			
		||||
    this.sent_hb_to_all_users = false;
 | 
			
		||||
    this.is_initialized = true;
 | 
			
		||||
    return this.connections_listeners = [];
 | 
			
		||||
    return this.is_initialized = true;
 | 
			
		||||
  },
 | 
			
		||||
  onUserEvent: function(f) {
 | 
			
		||||
    if (this.connections_listeners == null) {
 | 
			
		||||
      this.connections_listeners = [];
 | 
			
		||||
    }
 | 
			
		||||
    return this.connections_listeners.push(f);
 | 
			
		||||
  },
 | 
			
		||||
  isRoleMaster: function() {
 | 
			
		||||
@ -72,6 +74,7 @@ module.exports = {
 | 
			
		||||
    var f, i, len, ref, results;
 | 
			
		||||
    delete this.connections[user];
 | 
			
		||||
    this.findNewSyncTarget();
 | 
			
		||||
    if (this.connections_listeners != null) {
 | 
			
		||||
      ref = this.connections_listeners;
 | 
			
		||||
      results = [];
 | 
			
		||||
      for (i = 0, len = ref.length; i < len; i++) {
 | 
			
		||||
@ -82,6 +85,7 @@ module.exports = {
 | 
			
		||||
        }));
 | 
			
		||||
      }
 | 
			
		||||
      return results;
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  userJoined: function(user, role) {
 | 
			
		||||
    var base, f, i, len, ref, results;
 | 
			
		||||
@ -99,6 +103,7 @@ module.exports = {
 | 
			
		||||
        this.performSyncWithMaster(user);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if (this.connections_listeners != null) {
 | 
			
		||||
      ref = this.connections_listeners;
 | 
			
		||||
      results = [];
 | 
			
		||||
      for (i = 0, len = ref.length; i < len; i++) {
 | 
			
		||||
@ -110,6 +115,7 @@ module.exports = {
 | 
			
		||||
        }));
 | 
			
		||||
      }
 | 
			
		||||
      return results;
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  whenSynced: function(args) {
 | 
			
		||||
    if (args.constructore === Function) {
 | 
			
		||||
 | 
			
		||||
										
											
												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,6 +4,7 @@
 | 
			
		||||
        <meta charset=utf-8 />
 | 
			
		||||
        <title>Y Example</title>
 | 
			
		||||
        <script src="../../build/browser/y.js"></script>
 | 
			
		||||
        <script src="../../../y-text/build/browser/y-text.js"></script>
 | 
			
		||||
        <script src="../../../y-webrtc/build/browser/y-webrtc.js"></script>
 | 
			
		||||
        <script src="./index.js"></script>
 | 
			
		||||
</head>
 | 
			
		||||
@ -14,7 +15,7 @@ and WebRTC Connector. </p>
 | 
			
		||||
 | 
			
		||||
<textarea style="width:80%;" rows=40 id="textfield"></textarea>
 | 
			
		||||
 | 
			
		||||
<p> <a href="https://github.com/rwth-acis/yjs/">yjs</a> is a Framework for Real-Time collaboration on arbitrary data types.
 | 
			
		||||
<p> <a href="https://github.com/y-js/yjs/">yjs</a> is a Framework for Real-Time collaboration on arbitrary data types.
 | 
			
		||||
</p>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
 | 
			
		||||
@ -19,8 +19,8 @@ window.onload = function(){
 | 
			
		||||
  });
 | 
			
		||||
  connector.whenSynced(function(){
 | 
			
		||||
    if(y.val("textfield") == null){
 | 
			
		||||
      y.val("headline","headline", "mutable");
 | 
			
		||||
      y.val("textfield","stuff", "mutable")
 | 
			
		||||
      y.val("headline", new Y.Text("headline"));
 | 
			
		||||
      y.val("textfield",new Y.Text("stuff"))
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,5 @@
 | 
			
		||||
<script src="../../build/browser/y.js"></script>
 | 
			
		||||
<script src="../../../y-text/build/browser/y-text.js"></script>
 | 
			
		||||
<link rel="import" href="../../build/browser/y-object.html">
 | 
			
		||||
<link rel="import" href="../../../y-xmpp/build/browser/y-xmpp.html">
 | 
			
		||||
<link rel="import" href="../../../paper-slider/paper-slider.html">
 | 
			
		||||
@ -28,7 +30,7 @@
 | 
			
		||||
      var that = this;
 | 
			
		||||
      this.connector.whenSynced(function(){
 | 
			
		||||
        if(that.y.val("text") == null){
 | 
			
		||||
          that.y.val("text","stuff","mutable");
 | 
			
		||||
          that.y.val("text",Y.Text("stuff"));
 | 
			
		||||
        }
 | 
			
		||||
        that.y.val("text").bind(that.$.text,that.shadowRoot)
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@
 | 
			
		||||
        <meta charset=utf-8 />
 | 
			
		||||
        <title>Y Example</title>
 | 
			
		||||
        <script src="../../build/browser/y.js"></script>
 | 
			
		||||
        <script src="../../../y-text/build/browser/y-text.js"></script>
 | 
			
		||||
        <script src="../../../y-xmpp/y-xmpp.js"></script>
 | 
			
		||||
        <script src="./index.js"></script>
 | 
			
		||||
</head>
 | 
			
		||||
@ -14,7 +15,7 @@ and XMPP Connector. </p>
 | 
			
		||||
 | 
			
		||||
<textarea style="width:80%;" rows=40 id="textfield"></textarea>
 | 
			
		||||
 | 
			
		||||
<p> <a href="https://github.com/rwth-acis/yjs/">yjs</a> is a Framework for Real-Time collaboration on arbitrary data types.
 | 
			
		||||
<p> <a href="https://github.com/y-js/yjs/">yjs</a> is a Framework for Real-Time collaboration on arbitrary data types.
 | 
			
		||||
</p>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
 | 
			
		||||
@ -18,8 +18,8 @@ window.onload = function(){
 | 
			
		||||
  });
 | 
			
		||||
  connector.whenSynced(function(){
 | 
			
		||||
    if(y.val("textfield") == null){
 | 
			
		||||
      y.val("headline","headline", "mutable");
 | 
			
		||||
      y.val("textfield","stuff", "mutable")
 | 
			
		||||
      y.val("headline", new Y.Text("headline"));
 | 
			
		||||
      y.val("textfield",new Y.Text("stuff"))
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -70,6 +70,7 @@ module.exports =
 | 
			
		||||
  userLeft: (user)->
 | 
			
		||||
    delete @connections[user]
 | 
			
		||||
    @findNewSyncTarget()
 | 
			
		||||
    if @connections_listeners?
 | 
			
		||||
      for f in @connections_listeners
 | 
			
		||||
        f {
 | 
			
		||||
          action: "userLeft"
 | 
			
		||||
@ -91,6 +92,7 @@ module.exports =
 | 
			
		||||
        # TODO: What if there are two masters? Prevent sending everything two times!
 | 
			
		||||
        @performSyncWithMaster user
 | 
			
		||||
 | 
			
		||||
    if @connections_listeners?
 | 
			
		||||
      for f in @connections_listeners
 | 
			
		||||
        f {
 | 
			
		||||
          action: "userJoined"
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "yjs",
 | 
			
		||||
  "version": "0.4.1",
 | 
			
		||||
  "version": "0.5.0",
 | 
			
		||||
  "description": "A Framework that enables Real-Time Collaboration on arbitrary data structures.",
 | 
			
		||||
  "main": "./build/node/y.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user