Permalink
Browse files

Make Meteor._WriteFence available on the client as well as the server…

…. Keep

Meteor._CurrentWriteFence on server only.
  • Loading branch information...
1 parent e6a9ad6 commit 0092a560f26c4499149e0aefa2268e7ed6f0c4b1 @glasser glasser committed Nov 7, 2012
Showing with 8 additions and 6 deletions.
  1. +6 −0 packages/livedata/livedata_server.js
  2. +1 −1 packages/livedata/package.js
  3. +1 −5 packages/livedata/writefence.js
@@ -442,6 +442,12 @@ _.extend(Meteor._LivedataSession.prototype, {
}
});
+// The current write fence. When there is a current write fence, code
+// that writes to databases should register their writes with it using
+// beginWrite().
+Meteor._CurrentWriteFence = new Meteor.EnvironmentVariable;
+
+
/******************************************************************************/
/* LivedataSubscription */
/******************************************************************************/
@@ -11,7 +11,7 @@ Package.on_use(function (api) {
// manage the current set of subscriptions.
api.use('minimongo', ['client', 'server']);
- api.add_files('writefence.js', 'server');
+ api.add_files('writefence.js', ['client', 'server']);
api.add_files('crossbar.js', 'server');
api.add_files('livedata_common.js', ['client', 'server']);
@@ -11,11 +11,6 @@ Meteor._WriteFence = function () {
self.completion_callbacks = [];
};
-// The current write fence. When there is a current write fence, code
-// that writes to databases should register their writes with it using
-// beginWrite().
-Meteor._CurrentWriteFence = new Meteor.EnvironmentVariable;
-
_.extend(Meteor._WriteFence.prototype, {
// Start tracking a write, and return an object to represent it. The
// object has a single method, committed(). This method should be
@@ -62,6 +57,7 @@ _.extend(Meteor._WriteFence.prototype, {
},
// Convenience function. Arms the fence, then blocks until it fires.
+ // Only can be called on the server.
armAndWait: function () {
var self = this;
var future = new Future;

0 comments on commit 0092a56

Please sign in to comment.