Reputation: 1776
I am using meteor-sharejs
I add the package
meteor add mizzao:sharejs-ace
Now in my view, i add the document
{{> sharejsAce docid="javascriptDoc" id="editor"}}
I know that meteor-sharejs creates ops collection and docs.
My Questions is how do i grab the current raw text of of the "javascriptDoc" document on the server so i send it somewhere else. Like listen for changes and grab that content.
Upvotes: 2
Views: 500
Reputation: 1776
My final solution
Meteor.methods({
getDocumentText: function () {
var result = getSnapshotSync('htmlDocumentId');
return result.snapshot;
}
});
//create sync method.
getSnapshotSync = Meteor.wrapAsync(ShareJS.model.getSnapshot)
Upvotes: 1
Reputation: 36910
You probably want to check the ShareJS API for this.
mizzao:sharejs
is currently using ShareJS 0.6.3; here is the server API. You probably want to use the getSnapshot
function.
The package makes ShareJS available in ShareJS.model
, so try ShareJS.model.getSnapShot(...)
on the server.
Note: I wrote this package.
Upvotes: 2