lando.events.on(name, [priority], fn) ⇒ Promise

Our overriden event on method.

This optionally allows a priority to be specified. Lower priorities run first.

Since: 3.0.0

Param Type Default Description
name String The name of the event
[priority] Integer 5 The priority the event should run in.
fn function The function to call. Should get the args specified in the corresponding emit declaration.

Returns: Promise - A Promise
Example

// Print out all our apps as they get instantiated and do it before other `post-instantiate-app` events
lando.events.on('post-instantiate-app', 1, app => {
  console.log(app);
});

// Log a helpful message after an app is started, don't worry about whether it runs before or
// after other `post-start` events
return app.events.on('post-start', () => {
  lando.log.info('App %s started', app.name);
});

lando.events.emit(name, [...args]) ⇒ Promise

Reimplements event emit method.

This makes events blocking and promisified.

Since: 3.0.0

Param Type Description
name String The name of the event
[...args] Any Options args to pass.

Returns: Promise - A Promise
Example

// Emits a global event with a config arg
return lando.events.emit('wolf359', config);

// Emits an app event with a config arg
return app.events.emit('sector001', config);

results matching ""

    No results matching ""