js-interop:如何用js-interop实现javascript`new`到dart?

时间:2014-03-21 15:48:11

标签: dart dart-js-interop

javascript代码是..

var terminal = new hterm.Terminal('nike');

我尝试使用js-interop

var obj = js.context['hterm']['Terminal'];
var terminal = obj('nike');

但结果是错误的。如何使用js-interop将new关键字从javascript更改为dart?

1 个答案:

答案 0 :(得分:2)

使用dart:js

var obj = js.context['hterm']['Terminal'];
var terminal = new js.JsObject(obj,['nike']);