polyfill 的现代化条件加载

Modernizer conditional load of polyfill

我正在使用一个 javascript 库,它使用 Android 4.1 似乎不完全支持的 CustomEvent。所以我想我会使用 Modernizer 有条件地在浏览器中加载 CustomEvent polyfill 的地方。

但是我得到一个错误:TypeError: Modernizr.load is not a function

有人可以确认我没有完全离开这里的滑雪道并且我正确使用了 modernizer 吗?我是否必须下载另一个脚本或其他东西才能获得 Modernizer.load 功能? (自从提出类似问题后,Modernizer 似乎发生了变化)。

Modernizr.load was removed from Modernizr

Modernizr.load has been deprecated in favor of using yepnope.js directly; from v3.0, yepnope.js must be included in the page in order for Modernizr.load to work: calling .load() will simply pass the arguments on to yepnope(); this will be removed fully in a future release (#1241)