问题描述
我想将 pbkdf2 npm 库包含到我的 JS/html 页面中,这些页面只是纯 Javascript,节点不可用。
browserify 应该有我在那里。我编写了一个使用该功能的简短 JS 文件 (main.js)。
var callback = function (err,key) {
console.log(key);
}
function hashIt(hac,callback) {
pbkdf2.pbkdf2(hac,hac,10000,32,'sha256',callback);
}
我使用 browserify 使其成为“可包含的”JS 文件
browserify main.js -o bundle.js
bundle.js 文件看起来不错,就像 browserify 发挥了它的魔力一样。
我在 HTML 页面中包含了 bundle.js 文件,但是我无法访问 hashIt 函数。是否有一种特殊的方式来包含或调用 bundle.js 中的函数?