Skip to content

Latest commit

 

History

History
executable file
·
77 lines (57 loc) · 1.34 KB

README.md

File metadata and controls

executable file
·
77 lines (57 loc) · 1.34 KB

clinical:extended-api

API extensions for Meteor core objects.

Installation

First, install the extended-api package from the command line, like so:

meteor add clinical:extended-api

API

Random.date(maxDateAgo, dateFormat)

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());

Session.toggle(key)

Function, Client Toggle a variable true/false in the session.

//example
Session.setDefault("widgetIsOpen", false);

Template.myTemplate.events({
  'click #displayWidgetButton':function(){
    Session.toggle("widgetIsOpen");
  }
});

Session.clear(key)

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");
  }
});

Mongo.Collection.drop()

Function, Server Drop the entire collection.

var Foo = new Mongo.Collection(null);
Foo.insert({text: "foo"});
Foo.drop();

Testing

View the TinyTests results by doing the following:

cd myapp/packages/extended-api
meteor test-packages

Licensing

MIT License. Use as you will.