Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Use sharedb's util.nextTick() #29

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var Mingo = require('mingo');
var cloneDeep = require('lodash.clonedeep');
var isObject = require('lodash.isobject');
var sharedbMongoUtils = require('./sharedb-mongo-utils');
var util = require('sharedb/lib/util');

// This is designed for use in tests, so load all Mingo query operators
require('mingo/init/system');
Expand Down Expand Up @@ -43,7 +44,7 @@ function extendMemoryDB(MemoryDB) {
var includeMetadata = options && options.metadata;
var db = this;
if (typeof callback !== 'function') throw new Error('Callback required');
process.nextTick(function() {
util.nextTick(function() {
var collectionDocs = db.docs[collection];
var snapshots = [];
// Include metadata for the snapshots we are about to query, so the metadata
Expand Down Expand Up @@ -99,7 +100,7 @@ function extendMemoryDB(MemoryDB) {
var includeMetadata = options && options.metadata;
var db = this;
if (typeof callback !== 'function') throw new Error('Callback required');
process.nextTick(function() {
util.nextTick(function() {
try {
var mingoQuery = new Mingo.Query(castToSnapshotQuery(query));
var snapshot = db._getSnapshotSync(collection, id, includeMetadata);
Expand Down
Loading