Skip to content

Commit

Permalink
Merge pull request #25 from rclai/collection-extensions
Browse files Browse the repository at this point in the history
Use collection-extensions
  • Loading branch information
Pieter Soudan committed Dec 9, 2015
2 parents 1a04b4c + 6893798 commit 95b92b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
15 changes: 2 additions & 13 deletions collection-behaviours.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var constructor = Mongo.Collection;
var behaviours = {};

CollectionBehaviours = {};
Expand Down Expand Up @@ -30,16 +29,6 @@ CollectionBehaviours.extendCollectionInstance = function (self) {
});
};

Mongo.Collection = function () {
var ret = constructor.apply(this, arguments);
Meteor.addCollectionExtension(function () {
CollectionBehaviours.extendCollectionInstance(this);
return ret;
};

Mongo.Collection.prototype = Object.create(constructor.prototype);

for (var func in constructor) {
if (constructor.hasOwnProperty(func)) {
Mongo.Collection[func] = constructor[func];
}
}
});
6 changes: 4 additions & 2 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ Package.onUse(function (api, where) {
api.use([
'mongo',
'underscore',
'lai:collection-extensions@0.1.3',
'matb33:collection-hooks@0.7.6'
], both);
} else {
api.use([
'mongo-livedata',
'underscore',
'collection-hooks'
'lai:collection-extensions',
'matb33:collection-hooks'
], both);
}

Expand All @@ -39,4 +41,4 @@ Package.onUse(function (api, where) {
], both);

api.export("CollectionBehaviours");
});
});

0 comments on commit 95b92b8

Please sign in to comment.