错误是:
未捕获错误:尚未为上下文加载模块名称“aylien_textapi”:_。使用require([])
我的代码是:
window.addEventListener('button', summarizeNow());
function summarizeNow() {
var AYLIENTextAPI = require('aylien_textapi');
var textapi = new AYLIENTextAPI({
application_id: "12049eaa",
application_key: "0050eee15d54ac3dbd69d868fc1e8570"
});
var current = window.location.href
var sum = document.getElementById("summary");
textapi.summarize({
url: 'current',
sentences_number: 5
}, function(error, response) {
if (error === null) {
response.sentences.forEach(function(s) {
sum.innerHTML = sum.innerHTML + s;
});
}
});
}
我用谷歌搜索它,文档说require('aylien_textapi')是一个应该使用require([])的顶级需求调用,虽然我不太清楚如何实现它。
感谢任何帮助,谢谢!