Module name has not been loaded yet for context

◇◆丶佛笑我妖孽 提交于 2019-12-08 09:33:43

问题


The error is :

Uncaught Error: Module name "aylien_textapi" has not been loaded yet for context: _. Use require([])

and my code is:

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;
        });
      }
    });
}

I've googled it and the documentation says that require('aylien_textapi') is a top-level require call that should use require([]), although I'm not too sure how to implement this.

Any help is appreciated, thanks!

来源:https://stackoverflow.com/questions/36143342/module-name-has-not-been-loaded-yet-for-context

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!