oracular / markRevealed
Function: markRevealed()
ts
function markRevealed(
state,
intent,
at
): EngineState;Defined in: predict.ts:97
Records that the app acted on the intent at at. Starts the reveal cooldown, during which predict().revealed is true and shouldReveal is false, and increments revealCount. Evidence and learned data are untouched.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | EngineState | The current state. Not mutated. |
intent | string | Name of an intent declared in the config. |
at | number | When the reveal happened. |
Returns
The next state.
Throws
RangeError when intent is not declared in the config.
Throws
TypeError when state is not an engine state or at is not finite.
Example
ts
state = markRevealed(state, 'upgrade', Date.now());
predict(state, 'upgrade', Date.now()).revealed; // true until the cooldown ends