Skip to main content

Commands

Commands are methods of the client. Each one returns a promise.

Available commands​

MethodRequires availableActionsEffect
startRecording()START_RECORDINGStart, or resume from PAUSED or NOTE_READY.
stopRecording()STOP_RECORDINGSame as Pause in the Nabla UI. Accepted without effect when nothing is recording, so repeating it is safe.
startNoteGeneration()GENERATE_NOTEStop the recording if needed, then generate the note. From NOTE_READY, regenerates it.
exportNote()EXPORT_NOTESame as the Export button: the noteExported event plus your configured callback.

Offer a command only when the iframe lists it in availableActions.

When a command resolves​

A command resolves once the iframe has run it: the recording has started or paused, the note was exported, or the note generation has started. A generation ends on stateChanged, with NOTE_READY or with reason set to NOTE_GENERATION_FAILED.

The iframe sends no stateChanged while one of your commands runs, and none while nothing changes. The new state follows right after the command resolves. Expect no update until then, and do not take the silence for a crash.

One command at a time​

A second call while one is pending rejects with BUSY. Wait for the first one to settle.

Timeouts​

A command that gets no answer within 30 seconds rejects with TIMEOUT and the reason NO_RESULT. This does not mean the command failed. The iframe answers when it is done, and that can take longer: the user may take time to allow the microphone, or the audio may still be uploading. The command can still succeed, and the late answer is dropped. Read stateChanged or getCurrentState() to learn the outcome.

Before ready​

A command called before ready waits for it. If ready rejects, the command rejects with the same error.

waitUntilClosable()​

waitUntilClosable() is not a command. It resolves once state.canBeClosed is true, immediately if it already is, so you can wait before you call destroy() or tear down the page. It has no timeout, and rejects with DESTROYED or CONTEXT_CHANGED. See Leave and switch encounters.