使用 lodash 4.11.1 时出现“_.debounce 不是函数”
"_.debounce is not a function" when using lodash 4.11.1
我是 lodash 的新手,但我正在尝试按照 this article. I can get it using v3.5 via this CDN 实施去抖动,但每次我尝试下载 4.11.1 并将其包含在我的项目中时,我都会得到一个 Uncaught Type Error: _.debounce is not a function
.
这是我的脚本,非常简单:
jQuery(window).on("resize", _.debounce(function() {
console.log("hello world");
}, 400));
知道为什么这不适用于较新版本的 lodash 吗?我引用了 the documentation 并且我在这里没有看到任何不合适的地方。很奇怪。
好吧,我觉得这很愚蠢。我完全错过了那里有两个单独的构建,"core" 和 "full." 显然核心没有与 debounce
捆绑在一起。我现在已经可以使用完整的脚本了。
我是 lodash 的新手,但我正在尝试按照 this article. I can get it using v3.5 via this CDN 实施去抖动,但每次我尝试下载 4.11.1 并将其包含在我的项目中时,我都会得到一个 Uncaught Type Error: _.debounce is not a function
.
这是我的脚本,非常简单:
jQuery(window).on("resize", _.debounce(function() {
console.log("hello world");
}, 400));
知道为什么这不适用于较新版本的 lodash 吗?我引用了 the documentation 并且我在这里没有看到任何不合适的地方。很奇怪。
好吧,我觉得这很愚蠢。我完全错过了那里有两个单独的构建,"core" 和 "full." 显然核心没有与 debounce
捆绑在一起。我现在已经可以使用完整的脚本了。