Skip to content
This repository has been archived by the owner on Sep 28, 2018. It is now read-only.

Cant use: TextEncoder is not a constructor #76

Open
Bizarrus opened this issue Dec 28, 2017 · 3 comments
Open

Cant use: TextEncoder is not a constructor #76

Bizarrus opened this issue Dec 28, 2017 · 3 comments

Comments

@Bizarrus
Copy link

By the sample (https://github.com/inexorabletash/text-encoding#api-overview) i try to use these module.

But i can't insert your module to run it.

const TextEncoder = require('text-encoding'); message = new TextEncoder("utf-8").encode(message);

Is it only a clientside module or a serverside module? No informations given. Bad docs.

@paulkaplan
Copy link

Try const TextEncoder = require('text-encoding').TextEncoder;

@Bizarrus
Copy link
Author

Nope, it will create an Exception: ReferenceError: TextEncoder is not defined.
Same with Decoder.

@inexorabletash
Copy link
Owner

I strongly regret ever adding npm/package/module support. This is a client-side polyfill, and more a reference implementation than anything intended for production use.

Fixes welcome that don't break the non-module approach.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants