Application

Obsidian Factory Function

To get a new Obsidian application, you must use the Obsidian application factory function.

obsidian(name="obsidian")

Obsidian application factory.

Arguments:
  • name (string) – The name of the application (default: "obsidian").
Returns:

Application – A new Obsidian application.

E.g.:

const obsidian = require("@obsidianjs/obsidian");
const app = obsidian("my-application");

Application Class Reference

Warning

Do not instanciate the Application class yourself, use the Obsidian Factory Function instead.

class Application(name="obsidian", namespace="obsidian", dependencies={}, modules={})

Obsidian Application.

Arguments:
  • name (string) – The name of the application (default: "obsidian").
  • namespace (string) – The namespace, generally the module name (default: "obsidian").
  • dependencies (Object) – Application dependencies.
  • dependencies.modulesLoader (ModulesLoader) – An instance of the module loader.
  • dependencies.config (Config) – An instance of the config handler.
  • dependencies.events (Events) – An instance of the event dispatcher.
  • dependencies.log (Logging) – An instance of the logger.
  • dependencies.rootApp (Application) – (optional) An instance of the root application, if any.
  • modules (Object) – (optional) The modules that should be accessible through this application.
Application.name

type: string

The application name.

Application.namespace

type: string

The current namespace (usually, the current module name).

Application.modules

Access to loaded modules.

If you access this property from inside a module, you will only access the modules you required. See Obsidian Module Definition.

Application.use(module, params={})

Add a module to the current application.

Arguments:
  • module (Object) – The module to add (see Obsidian Module Definition).
  • params (Object) – (optional) Additional parameters for the module
Application.unload(module)

Unload a module.

Arguments:
  • module (string|Object) – The module (object or name) to unload.
Application.start(config)

Start the application.

Arguments:
  • config (Object) – Application’s confguration
Returns:

Promise.<undefined> – This promise can be usually left unhandled.

Application.config

type: Config

Handles application configuration. See Config.

Application.events

type: Events

Handles application events. See Events.

Application.isStarted

type: boolean

Indicate whether the application is started or not.

Application.log

type: Logging

Handles application logging. See Logging.