Meteor - Core Api


Advertisements


If you want to limit the code to run only on the server or the client side, you can use the following code −

meteorApp.js

if (Meteor.isClient) {
   // Code running on client...
}

if (Meteor.isServer) {
   // Code running on server...
}

You can limit the code to run only when the app is using Cordova bundling.

if (Meteor.isCordova) {
   // Code running on Cordova...
}

Some plugins need to wait until the server and DOM are ready. You can use the following code to wait until everything begins.

Meteor.startup(function () {
   // Code running after platform is ready...
});

Following table lists some other core API methods.

Sr.No. Method & Details
1

Meteor.wrapAsync(function)

Used for wrapping asynchronous code and convert it into synchronous.

2

Meteor.absoluteUrl([path], [options])

Used for generating absolute URL pointing to the app.

3

Meteor.settings

Used for setting deployment configuration.

4

Meteor.publish(name, function)

Used for publishing records to the client.



Advertisements
E-Books Store