user3142695 user3142695 - 1 year ago 77
Javascript Question

How to check if a Meteor package is currently installed?

I need to check if the package

is installed in my app.

Only then another template is used (which is part of this package).

Something like this:

<template name="example">
{{#if hasNotificationPackage}}

How do I do that?

Answer Source

Meteor provides a global object called Package that contains all of the Meteor package exports.

Therefore, you can use something like

  hasNotificationPackage() {
    return (typeof Package['my-package:notification'] === 'object');

I am not sure that depending on the availability of a package this way is something that should be used often, especially in production.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download