API extensions for Meteor core objects.
First, install the extended-api package from the command line, like so:
meteor add clinical:extended-api
Function, Client
Random.date();
Random.date("1975-01-01");
Random.date("1975-01-01", "YYYY/MM/DD");
Random.date(null, "YYYY/MM/DD");
new Date(Random.date());
Function, Client Toggle a variable true/false in the session.
//example
Session.setDefault("widgetIsOpen", false);
Template.myTemplate.events({
'click #displayWidgetButton':function(){
Session.toggle("widgetIsOpen");
}
});
Function, Client
Toggle a variable true/false in the session.
//example
Session.setDefault("selectedPurchaseItemId", Meteor.user().profile.selectedItemId);
Template.myTemplate.events({
'click #emptyShoppingCart':function(){
Session.clear("selectedPurchaseItemId");
}
});
Function, Server Drop the entire collection.
var Foo = new Mongo.Collection(null);
Foo.insert({text: "foo"});
Foo.drop();
View the TinyTests results by doing the following:
cd myapp/packages/extended-api
meteor test-packages
MIT License. Use as you will.