Skip to content

clinical-meteor/extended-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

API extensions for Meteor core objects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%