다트에서 js.dart를 통해 paper.js를 사용하려고합니다.NoSuchMethodError with dart.js
많은 것이 작동하는 것처럼 보이지만 paper.js의 importSVG
메소드도 필요합니다. js.context.paper.project.importSVG(query("#svg"));
으로 액세스하려고하면 NoSuchMethodError
이 표시됩니다. 메소드가 프로젝트에 삽입 되었기 때문에 어떻게 든됩니다. 아래의 paper.js 코드를 참조하십시오.
어떻게 Dart에서 importSVG
메서드에 액세스합니까?
/* paper.js */
new function() {
function importSVG(node, clearDefs) {
// ...
}
Item.inject(/** @lends Item# */{
/**
* Converts the passed node node into a Paper.js item and adds it to the
* children of this item.
*
* @param {SVGSVGElement} node the SVG DOM node to convert
* @return {Item} the converted Paper.js item
*/
importSVG: function(node) {
return this.addChild(importSVG(node, true));
}
});
Project.inject(/** @lends Project# */{
/**
* Converts the passed node node into a Paper.js item and adds it to the
* active layer of this project.
*
* @param {SVGSVGElement} node the SVG DOM node to convert
* @return {Item} the converted Paper.js item
*/
importSVG: function(node) {
this.activate();
return importSVG(node, true);
}
});
};
http : //paper.js를 잠깐 살펴보면 js.context.paper.project.importSVG (query ("# svg"));가 올바르게 호출 된 것으로 보입니다. 전체 오류를 붙여 주실 수 있습니까? –
답변 해 주셔서 감사합니다. "예외 발생 : NoSuchMethodError : 메서드를 찾을 수 없음 : 'importSVG'"js.dart에서 throw 됨 : 1038 –
꽤 이상합니다. _chrome 개발자 도구로 테스트 할 수 있습니까?이 메서드는 javascript에 정의되어 있습니까? 콘솔에서'paper.project.importSVG'를 입력하십시오. 당신은'function (node) {this.activate(); return importSVG (node, true); }' –