-
Notifications
You must be signed in to change notification settings - Fork 459
Expand file tree
/
Copy pathno-op.ts
More file actions
35 lines (29 loc) · 1.15 KB
/
no-op.ts
File metadata and controls
35 lines (29 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var MilestoneDB = require('./index');
var util = require('../util');
/**
* A no-op implementation of the MilestoneDB class.
*
* This class exists as a simple, silent default drop-in for ShareDB, which allows the backend to call its methods with
* no effect.
*/
module.exports = NoOpMilestoneDB;
function NoOpMilestoneDB(options) {
MilestoneDB.call(this, options);
}
NoOpMilestoneDB.prototype = Object.create(MilestoneDB.prototype);
NoOpMilestoneDB.prototype.getMilestoneSnapshot = function(collection, id, version, callback) {
var snapshot = undefined;
util.nextTick(callback, null, snapshot);
};
NoOpMilestoneDB.prototype.saveMilestoneSnapshot = function(collection, snapshot, callback) {
if (callback) return util.nextTick(callback, null);
this.emit('save', collection, snapshot);
};
NoOpMilestoneDB.prototype.getMilestoneSnapshotAtOrBeforeTime = function(collection, id, timestamp, callback) {
var snapshot = undefined;
util.nextTick(callback, null, snapshot);
};
NoOpMilestoneDB.prototype.getMilestoneSnapshotAtOrAfterTime = function(collection, id, timestamp, callback) {
var snapshot = undefined;
util.nextTick(callback, null, snapshot);
};