提交 f990f9a8 编写于 作者: S Sandeep Somavarapu

Use text encoder if available

上级 6c72a0bf
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
export function toUint8ArrayBuffer(str: string): ArrayBuffer { export function toUint8ArrayBuffer(str: string): ArrayBuffer {
if (typeof TextEncoder !== undefined) {
return new TextEncoder().encode(str).buffer;
}
let i: number, len: number, length = 0, charCode = 0, trailCharCode = 0, codepoint = 0; let i: number, len: number, length = 0, charCode = 0, trailCharCode = 0, codepoint = 0;
// First pass, for the size // First pass, for the size
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册