Use text-encoding-utf-8 as a TextEncoder polyfill
Somebody else seems to have done a good job of polyfilling TextEncoder, so let's use that.
This commit is contained in:
parent
09ce74cc76
commit
31df78f946
7 changed files with 89 additions and 336 deletions
|
@ -17,13 +17,14 @@ limitations under the License.
|
|||
"use strict";
|
||||
|
||||
// polyfill textencoder if necessary
|
||||
import * as TextEncodingUtf8 from 'text-encoding-utf-8';
|
||||
let TextEncoder = window.TextEncoder;
|
||||
if (!TextEncoder) {
|
||||
TextEncoder = require('./TextEncoderPolyfill');
|
||||
TextEncoder = TextEncodingUtf8.TextEncoder;
|
||||
}
|
||||
let TextDecoder = window.TextDecoder;
|
||||
if (TextDecoder) {
|
||||
TextDecoder = require('./TextDecoderPolyfill');
|
||||
if (!TextDecoder) {
|
||||
TextDecoder = TextEncodingUtf8.TextDecoder;
|
||||
}
|
||||
|
||||
const subtleCrypto = window.crypto.subtle || window.crypto.webkitSubtle;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue