小编Aus*_*one的帖子

导入文本编码的polyfill后,为什么在IE11中出现“ ReferenceError:'TextEncoder'未定义”的问题?

我正在尝试对库fetch-readystream(https://github.com/jonnyreeves/fetch-readystream)进行轮询。我已经添加了polyfills,并且大多数事情都能正常工作,但是我仍然收到有关TextEncoder的错误ERROR ReferenceError: 'TextEncoder' is undefined

我添加了必需的pollyfills:web-streams-polyfill,text-encoding和babel-polyfill。我尝试了这些polyfill的其他等效方法,但遇到了同样的问题。

polyfills.ts所需要的IE进口,我注释掉后的文件。

import 'web-streams-polyfill'; // Run `npm install --save web-streams-polyfill`.
import 'text-encoding'; // Run `npm install --save text-encoding`.
import 'babel-polyfill'; // Run `npm install --save babel-polyfill`.
Run Code Online (Sandbox Code Playgroud)

我也尝试将脚本添加到 index.html

<script src="node_modules/text-encoding/lib/encoding-indexes.js"></script>
<script src="node_modules/text-encoding/lib/encoding.js"></script>
Run Code Online (Sandbox Code Playgroud)

我不希望有任何错误,但是我得到了:

ERROR ReferenceError: 'TextEncoder' is undefined
   "ERROR"
   {
      [functions]: ,
      __proto__: { },
      description: "'TextEncoder' is undefined",
      message: "'TextEncoder' is undefined",
      name: "ReferenceError",
      number: -2146823279,
      stack: "ReferenceError: 'TextEncoder' is undefined
   at responseParserFactory (http://localhost:4200/vendor.js:139703:3)
   at xhrTransport (http://localhost:4200/vendor.js:139960:1)
   at fetchStream …
Run Code Online (Sandbox Code Playgroud)

polyfills angular

7
推荐指数
1
解决办法
579
查看次数

空字符串或空变量的 JSON 标准是什么?

我正在构建一个解析 JSON 模板的应用程序,然后用新数据替换对象的值。我的问题是在 JSON 中表示空数据的标准方法是什么?

这就是我现在处理的方式:

  • 空字符串表示为“”
  • 一个空的 int/float/double/bool/等。表示为 NULL

这样对吗?

json cjson

3
推荐指数
1
解决办法
2万
查看次数

Deno 属性“utime”在类型“typeof Deno”上不存在。等待 Deno.utime(dest, statInfo.atime, statInfo.mtime);

我正在尝试使用标准 deno fs 模块,但编译器抱怨没有--unstable标志。

import { writeJson, readJson } from "https://deno.land/std/fs/mod.ts";

const json = await readJson("input.txt");
console.log(`JSON: ${JSON.stringify(json)}`);
await writeJson("input.txt", json);
Run Code Online (Sandbox Code Playgroud)

我的 deno 版本:

deno 1.0.0-rc2
v8 8.4.300
typescript 3.8.3
Run Code Online (Sandbox Code Playgroud)

我总是遇到相同的错误。它们似乎与缺少模块有关,但我不确定可能缺少什么。

?  deno-api denoa filetest.ts 
Compile file:///home/astone/source/deno-api/filetest.ts
error: TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
    await Deno.utime(dest, statInfo.atime, statInfo.mtime);
               ~~~~~
    at https://deno.land/std/fs/copy.ts:90:16

TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
    Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
         ~~~~~~~~~
    at https://deno.land/std/fs/copy.ts:101:10

TS2339 [ERROR]: Property 'symlink' does …
Run Code Online (Sandbox Code Playgroud)

deno

3
推荐指数
1
解决办法
702
查看次数

标签 统计

angular ×1

cjson ×1

deno ×1

json ×1

polyfills ×1