faastjs.faastmodule.on.md

April 5, 2024 ยท View on GitHub

faastjs > FaastModule > on

FaastModule.on() method

Register a callback for statistics events.

Signature:

on(name: "stats", listener: (statsEvent: FunctionStatsEvent) => void): void;

Parameters

Parameter

Type

Description

name

"stats"

listener

(statsEvent: FunctionStatsEvent) => void

**Returns:**

void

Remarks

The callback is invoked once for each cloud function that was invoked within the last 1s interval, with a FunctionStatsEvent summarizing the statistics for each function. Typical usage:

faastModule.on("stats", console.log);