When I try to create a Range object in ace.js, an “Illegal Constructor” error is thrown

孤人 提交于 2019-11-30 07:08:41

Range is a native type is most browsers that you cannot instantiate. I'm not really familiar with Ace, but I'm guessing that they use some sort of namespacing so that you will do something like new Ace.Range().

Edit: It looks like they are using CommonJS, so you can import the method and alias it however you like:

var Range = require('ace/range').Range,
    mine = new Range(0,0,10,0);
ANUSHA E

Replace require('ace/range').Range with ace.require('ace/range').Range

This solution var Range = ace.acequire('ace/range').Range; works for me!!!

Full code: https://stackoverflow.com/a/53387989/630169

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