javascript - 通过 CDN 包含 Streams 模块

标签 javascript mithril.js

我是 Mithrill v1.0.0 的新手,现在遇到了问题。在以前的版本中,我可以使用 m.prop() 作为 setter/getter 变量。在新版本中,它被Streams模块取代。

在 Mithrill 文档中说:

Streams are NOT bundled with Mithril's core distribution. To include the Streams module, use:

var Stream = require("mithril/stream")

我的问题是我不知道如何包含它。我通过 CDN 使用 mithrill。当我尝试直接使用 prop()stream() 时,它给出了函数未定义的错误。

最佳答案

<script src="https://unpkg.com/mithril/stream/stream.js"></script>

它将以 window.stream 形式提供。

关于javascript - 通过 CDN 包含 Streams 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42106452/

相关文章:

javascript - 用户提交弹出表单时发送多个ajax调用

mithril.js - 避免在模块化 View 模型上进行全局重绘

javascript - 如何在 Mithril 中对具有 View 模型依赖性的 View 进行单元测试?

javascript - 在 Mithril JS 中等待 AJAX 请求时如何显示微调器?

javascript - 使用javascript按ID删除输入元素

javascript - 如何在 angularjs 拦截器中重定向,除非出现错误?

javascript - redux - 如何存储和更新键/值对

javascript - 测试 Vue.js 过滤器

javascript - Mithril 上的事件捕获?

javascript - 在 Mithril.js 中,当给定条件成立时,如何创建一个函数来调用自身