javascript - Ace Editor and meteor for collaborative code editing: Observe hangs app -


i trying make basic collaborative code editor in meteor using ace editor. javascript follows: var file meteor.startup(function(){

        session.set("file", "fileid");         var query = files.find({_id : session.get("fileid")});          var handle = query.observe({                   changed : function(newdoc, olddoc) {               if(editor !== undefined){                 console.log("doc changed ", olddoc.contents, "to ",  newdoc.contents);                 editor.setvalue(newdoc.contents);               }               handle.stop();             }         });               editor.getsession().on('change', function(e) {         // update file collection         if(session.get('file')) {             files.update({_id: session.get("file")},                { $set :                  {                    contents : editor.getvalue()                 }               });         }     });       }); 

the editor able update database without ado, however, query handles observing changes , setting document new value hangs , doesn't anything. what's issue? or in general what's better way solve problem (of making ace editor collaborative using meteor...assuming want code myself..and not use meteorite or something)

thanks!

using ace editor directly meteor result in laggy operations , clunky interactions between users unless write , debug whole lot of code.

another approach attach sharejs stack meteor, because integrates ace. in fact, ended doing after looking @ other ways collaborative editing in meteor:

https://github.com/mizzao/meteor-sharejs

there (out-of-date) demo here: http://documents.meteor.com


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -