Appearance
Class: Poll
A native Kappapps poll. Use kapp.poll.start(), get() or resume(). A restarted owner installation can explicitly resume control. Other installations cannot. Subscribe with onEnd() before closing: the callback can run before the HTTP promise settles. Reconnect/read participants to recover current state; live callbacks are not an audit log.
Properties
data
ts
data: PollData = null;FINISH_STATUS
ts
static FINISH_STATUS: string[];STATUS_ACTIVE
ts
static STATUS_ACTIVE: string = 'ACTIVE';STATUS_CANCELED
ts
static STATUS_CANCELED: string = 'CANCELED';STATUS_TERMINATED
ts
static STATUS_TERMINATED: string = 'TERMINATED';Methods
cancel()
ts
cancel(): Promise<void>;Cancel the poll. END may arrive before this promise resolves.
Returns
Promise<void>
getData()
ts
getData(): Promise<PollData>;Refresh state. Read the returned status as well as listening to events.
Returns
Promise<PollData>
getParticipants()
ts
getParticipants(query?): Promise<ParticipantsPage<PollParticipation>>;Owner-only current/final participations; follow next_cursor to read every page (max 200/page).
Parameters
query?
ParticipantsQuery = {}
Returns
Promise<ParticipantsPage<PollParticipation>>
getTallies()
ts
getTallies(): PollTally[];Returns
onEnd()
ts
onEnd(callback): () => void;Subscribe to termination or cancellation. Returns an unsubscribe function. Register before closing: the callback receives this model and can run before terminate()/cancel() resolves. Past endings are not replayed; also inspect data.
Parameters
callback
(poll) => void
Returns
() => void
onParticipation()
ts
onParticipation(callback): () => void;Accepted live changes with revision/event_id for reconciliation. Returns an unsubscribe function.
Parameters
callback
(participation) => void
Returns
() => void
terminate()
ts
terminate(): Promise<void>;Close with final results. END may arrive before this promise resolves.
Returns
Promise<void>
vote()
ts
vote(
user,
choice_id,
method?,
options?): Promise<void>;Replace the full ballot atomically. Every selected answer gets the full positive weight. Reuse idempotency_key after an unknown result; a different payload with that key conflicts. Rejections expose code, reason and status.
Parameters
user
string | User
choice_id
number | number[]
method?
"id" | "login"
options?
PollVoteOptions = {}
Returns
Promise<void>