Skip to content

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 ​

ParameterTypeDescription
stateEngineStateThe current state. Not mutated.
intentstringName of an intent declared in the config.
atnumberWhen the reveal happened.

Returns ​

EngineState

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

Released under the MIT License.