Use in your [base][] plugin to ensure that the plugin is registered on a valid instance.
var isValidInstance = require('{%= name %}');
function plugin(app) {
if (!isValidInstance(app)) return;
// do plugin stauff
}
{%= apidocs("index.js") %}
Collection instance
Return true if the instance is a [templates][] view-collection (views
):
function plugin(collection) {
if (!isValidInstance(collection, ['views'])) {
// optionally return the plugin function so the plugin is re-tried on
// each instance until it finds the correct one
return plugin;
}
// do plugin stauff
}
View instance
Return true if the instance is a [templates][] view:
function plugin(view) {
if (!isValidInstance(view, ['view'])) {
return plugin;
}
// do plugin stauff
}
View instance
Return true if the instance is either "app" or "collection":
function plugin(app) {
if (!isValidInstance(app, ['app', 'collection'])) {
return plugin;
}
// do plugin stauff
}