From cac4215dc98a35189d84c58c9693fe87a8117c10 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Wed, 22 Nov 2023 11:54:34 +0100 Subject: [PATCH] [encoding] Add annotations that toUint8Array should only be called once. closes #60 --- encoding.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/encoding.js b/encoding.js index e212d84..78ecea7 100644 --- a/encoding.js +++ b/encoding.js @@ -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) @@ -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) @@ -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)