From 9d3cc7ba2311b97fa4a72bc2dbbc05da24cae150 Mon Sep 17 00:00:00 2001 From: Yonder Date: Sat, 28 May 2022 14:30:19 -0700 Subject: [PATCH] Add browser compatibility (add to window object) This gives compatibility for browsers by adding on to the window object if `define` and `module.exports` isn't available. --- bit-buffer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bit-buffer.js b/bit-buffer.js index 60c7f79..5c2c773 100644 --- a/bit-buffer.js +++ b/bit-buffer.js @@ -498,5 +498,10 @@ else if (typeof module !== 'undefined' && module.exports) { BitStream: BitStream }; } +// browser +else if (typeof window !== 'undefined') { + window.BitView = BitView; + window.BitStream = BitStream; +} }(this));