Compilation Dart JavaScript输出失败:未找到方法:';新任务:1:0';接收方:实例';JsClassMirror';

Compilation Dart JavaScript输出失败:未找到方法:';新任务:1:0';接收方:实例';JsClassMirror';,compilation,dart,dart-mirrors,dart2js,Compilation,Dart,Dart Mirrors,Dart2js,我已经将一个方便的JS库移植到Dart:。it功能的关键部分可细分为: final Map\u registeredModules=new Map(); 寄存器(模块,[String moduleName]){ 最终uniqueModuleName=moduleName!=null?moduleName:module.runtimeType.toString(); 最终符号uniqueModuleIdentifier=新符号(uniqueModuleName); if(_registeredMo

我已经将一个方便的JS库移植到Dart:。it功能的关键部分可细分为:

final Map\u registeredModules=new Map();
寄存器(模块,[String moduleName]){
最终uniqueModuleName=moduleName!=null?moduleName:module.runtimeType.toString();
最终符号uniqueModuleIdentifier=新符号(uniqueModuleName);
if(_registeredModules.containsKey(uniqueModuleName)){
抛出新状态错误(“模块${moduleName}已注册!”);
}
最终类镜像=反射(模块)。类型;
_registeredModules[uniqueModuleIdentifier]=镜像;
}
开始(符号moduleName、字符串id、选项){
if(!\u registeredModules.containsKey(moduleName)){
抛出新状态错误(“模块${moduleName}未注册!”);
}
最终类镜像镜像=_registeredModules[moduleName];
最终符号moduleId=id!=null?新符号(id):moduleName;
最终沙盒沙盒=新沙盒(this.mediator);
if(_runningModules.containsKey(moduleId)){
抛出新的StateError(“id为#${moduleId}的模块已在运行!”);
}
final InstanceMirror moduleInstance=mirror.newInstance(新符号(“”),[sandbox],null);
moduleInstance.invoke(新符号(“开始”),[options]);
_运行模块[moduleId]=模块实例;
}
我还举了一个例子

示例的一部分;
课堂待办事项{
沙箱(沙箱);;
DivElement_contentEl;
int _nextToDoId=0;
乌利斯特勒姆(UListElement)托多利斯特;;
ToDos([沙箱这个._沙箱]);
开始([映射选项]){
这是。_initLocalStorage();
var html=['',
'',
'',
“添加”,
'',
“
    ”, “
”, '')。加入(''); 这个._contentEl=new Element.html(html); this._todoList=this._contentEl.query('ul'); 选项['containerell'].append(this.\u contentEl); window.localStorage.keys.forEach((key)=>this.\u renderToDo(key)); 这个; 此.u沙盒.channel('navigationbar')。主题('filter')。侦听((filterContent){ 该过滤器(过滤内容); }); 此._sandbox.channel('navigationbar')。主题('clearfilter')。侦听((filterContent){ this._todoList.queryAll('li span').forEach((element)=>element.parent.classes.remove('hide'); }); } 停止(){ 这个。_contentEl.remove(); } _initLocalStorage(){ if(window.localStorage.keys.length==0){ 变量映射={ "1": { “主题”:“食品:香蕉和苹果”, “isDone”:假 }, "2": { “主题”:“税收:照顾好他们”, “isDone”:假 }, "3": { “主题”:“拿出垃圾”, “isDone”:假 } }; for(map.keys中的变量键){ window.localStorage[key]=stringify(map[key]); 这个; } } 否则{ for(window.localStorage.keys中的var键){ var intKey=int.parse(key); 如果(intKey>this.\u nextToDoId){ 这个。_nextToDoId=intKey; } 这个; } } } _设置事件(){ var input=this._contentEl.query('input'); input.onKeyDown.listen((事件){ if(event.keyCode==keyCode.ENTER){ event.preventDefault(); 此.\u addToDo(input.value); input.value=''; } }); 此._contentEl.query('button[type=“Submit”]”)。onClick.listen((事件){ event.preventDefault(); 如果(input.value.length>0){ 此.\u addToDo(input.value); input.value=''; } }); this.\u topolist.onClick.listen((MouseEvent事件){ var el=事件目标; if(el.classes.contains('icon-remove')){ 本文件为删除TODO(el.parent); } else if(el.classes.contains('icon-ok')){ 这个。切换到牙齿(el.parent); } }); } _renderToDo(id){ var todoObject=parse(window.localStorage[id.toString()]); var html=['
  • ”, '',todoObject[“subject”],'', '', '', “
  • ”】。加入(“”); 这个._todoList.append(new-Element.html(html)); } _addToDo(文本){ var todoJson=stringify({ “主题”:文本, “isDone”:假 }); window.localStorage[this.\u nextToDoId.toString()]=todoJson; 这._renderToDo(这._nextToDoId); 这个; } _删除TODO(todoLIElement){ window.localStorage.remove(todoleElement.dataset[“id”]); todoLIElement.remove(); } _Toggletodone(TodoleElement){ var done=!todoleElement.classes.contains('done'); var id=todoleElement.dataset[“id”]; var todoObject=parse(window.localStorage[id]); todoObject[“isDone”]=完成; window.localStorage[id]=stringify(todoObject); 如果(完成){ todoLIElement.classes.add('done'); } 否则{ todoLIElement.classes.remove('done'); } } _过滤器(内容){ this._todoList.queryAll('li span').forEach((元素){ if(element.innerHtml.contains(content)){ element.parent.classes.remove('hide'); } 否则{ element.parent.classes.add('hide'); }
    moduleInstance.invoke(new Symbol("start"), [options]);
    
    moduleInstance.reflectee.start(options);