Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ Typr._bin = {
}
return s;
},
_tdec : typeof window !== 'undefined' && window["TextDecoder"] ? new window["TextDecoder"]() : null,
_tdec : function() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've changed the type of _tdec from TextDecoder | null to a function, so this would certainly break...?

I think maybe a better approach would be to check for TextDecoder global directly?

_tdec : typeof TextDecoder !== 'undefined' ? new TextDecoder() : null

There's probably also some adjustment to be made in troika-three-text where it tries to hack in worker support.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your reply.

I'm gonna open an issue in the Drei repos.

return typeof window !== 'undefined' && window["TextDecoder"] ? new window["TextDecoder"]() : null;
},
readUTF8 : function(buff, p, l) {
var tdec = Typr._bin._tdec;
if(tdec && p==0 && l==buff.length) return tdec["decode"](buff);
Expand Down