Skip to content

Commit

Permalink
[encoding] Add annotations that toUint8Array should only be called on…
Browse files Browse the repository at this point in the history
…ce. closes #60
  • Loading branch information
dmonad committed Nov 22, 2023
1 parent 00fbf0b commit cac4215
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions encoding.js
Expand Up @@ -762,6 +762,11 @@ export class UintOptRleEncoder {
}
}

/**
* Flush the encoded state and transform this to a Uint8Array.
*
* Note that this should only be called once.
*/
toUint8Array () {
flushUintOptRleEncoder(this)
return toUint8Array(this.encoder)
Expand Down Expand Up @@ -799,6 +804,11 @@ export class IncUintOptRleEncoder {
}
}

/**
* Flush the encoded state and transform this to a Uint8Array.
*
* Note that this should only be called once.
*/
toUint8Array () {
flushUintOptRleEncoder(this)
return toUint8Array(this.encoder)
Expand Down Expand Up @@ -866,6 +876,11 @@ export class IntDiffOptRleEncoder {
}
}

/**
* Flush the encoded state and transform this to a Uint8Array.
*
* Note that this should only be called once.
*/
toUint8Array () {
flushIntDiffOptRleEncoder(this)
return toUint8Array(this.encoder)
Expand Down

0 comments on commit cac4215

Please sign in to comment.