Vulcan/packages/nova-lib/lib/config.js

81 lines
2.5 KiB
JavaScript
Raw Normal View History

2016-02-17 14:39:56 +09:00
/**
* @summary Kick off the global namespace for Telescope.
2016-02-17 14:39:56 +09:00
* @namespace Telescope
*/
Telescope = {};
2016-07-04 10:42:36 +09:00
Telescope.VERSION = '0.26.4-nova';
2016-02-17 14:39:56 +09:00
2016-02-16 15:08:30 +09:00
// ------------------------------------- Config -------------------------------- //
/**
* @summary Telescope configuration namespace
2015-05-10 13:37:42 +09:00
* @namespace Telescope.config
*/
2016-02-16 15:08:30 +09:00
Telescope.config = {};
2016-02-16 15:08:30 +09:00
// ------------------------------------- Schemas -------------------------------- //
SimpleSchema.extendOptions({
private: Match.Optional(Boolean),
editable: Match.Optional(Boolean), // editable: true means the field can be edited by the document's owner
hidden: Match.Optional(Boolean), // hidden: true means the field is never shown in a form no matter what
required: Match.Optional(Boolean), // required: true means the field is required to have a complete profile
profile: Match.Optional(Boolean), // profile: true means the field is shown on user profiles
template: Match.Optional(String), // template used to display the field
autoform: Match.Optional(Object), // autoform placeholder
2016-04-04 16:50:07 +09:00
control: Match.Optional(Match.Any), // NovaForm control (String or React component)
order: Match.Optional(Number), // position in the form
group: Match.Optional(Object) // form fieldset group
2016-02-16 15:08:30 +09:00
});
// ------------------------------------- Components -------------------------------- //
Telescope.components = {};
Telescope.registerComponent = (name, component) => {
Telescope.components[name] = component;
};
Telescope.getComponent = (name) => {
return Telescope.components[name];
};
// ------------------------------------- Subscriptions -------------------------------- //
/**
* @summary Subscriptions namespace
2016-02-16 15:08:30 +09:00
* @namespace Telescope.subscriptions
*/
Telescope.subscriptions = [];
/**
* @summary Add a subscription to be preloaded
2016-02-16 15:08:30 +09:00
* @param {string} subscription - The name of the subscription
*/
Telescope.subscriptions.preload = function (subscription, args) {
Telescope.subscriptions.push({name: subscription, arguments: args});
2016-06-09 17:42:20 +09:00
};
// ------------------------------------- Strings -------------------------------- //
2016-06-09 17:42:20 +09:00
Telescope.strings = {};
// ------------------------------------- Routes -------------------------------- //
Telescope.routes = {
routes: [],
add(routeOrRouteArray) {
const addedRoutes = Array.isArray(routeOrRouteArray) ? routeOrRouteArray : [routeOrRouteArray];
this.routes = this.routes.concat(addedRoutes);
}
}
// ------------------------------------- Head Tags -------------------------------- //
Telescope.headtags = {
meta: [],
link: []
}