我正在尝试将Dart 中的resumable.js与以下代码一起使用:
var rs = new JS.JsObject(JS.context['Resumable'], [new JS.JsObject.jsify({
'target':context.server+'/upload'
})]);
files.forEach((file) {
rs.callMethod("addFile",[file]);
});
files变量定义为List<File>( dart.html.File)。当我rs用这两行检查对象的属性时:
JS.context["console"].callMethod("log",[rs['opts']]);
JS.context["console"].callMethod("log",[rs['files']]);
我发现它rs.opts已正确初始化,但rs.files始终包含ResumableFile长度为 1 的实例。我猜这是因为方法 addFile 期望参数是 Javascript 的实例,File但它得到了 instanceof dart:html.File。
您知道如何转换dart:html.File为 JavascriptFile或如何将参数传递给resumable.js吗?
我知道我可以选择使用方法assignBrowse和assignDrop,但我想坚持我的解决方案。