小编ato*_*ten的帖子

可转换的自定义类与ES6 Web工作者

在Javascript ES6中,在浏览器中,我想使用"Transferable"界面将自定义类对象传输给Web worker.这可能吗?我可以找到有关ArrayBuffer对象的文档,但不能找到自定义类对象的文档.

这与如何通过Web-Workers传递自定义类实例不重复因为我的问题是关于Transferable接口的.我想将自定义类实例传递给worker而不复制它.

web-worker ecmascript-6 transferable

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

SVG 蒙版渲染不正确

这是一个简单的 SVG 蒙版(fiddle):

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-100 -400 600 600">

  <!-- Here I define the mask, a white rectangle with a strip removed -->
  <defs>
    <mask id="mymask">
      <rect x="100" y="-200" width="200" height="100" fill="white"/>
      <path d="M 250 -150  L 150 -150" stroke="black" fill="none" stroke-opacity="1" fill-opacity="1" stroke-width="25"/>
    </mask>
  </defs>

  <!-- This masked blue rectangle is displayed correctly, and lets us see where the mask is -->
  <rect x="-100" y="-300" width="500" height="500" fill="blue" fill-opacity="0.2" mask="url(#mymask)"/>

  <!-- This green vertical line is …
Run Code Online (Sandbox Code Playgroud)

svg mask

0
推荐指数
1
解决办法
656
查看次数

标签 统计

ecmascript-6 ×1

mask ×1

svg ×1

transferable ×1

web-worker ×1