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