1

我喜欢移植到 Dart 的原始 javascript 代码。

hterm.defaultStorage = new lib.Storage.Chrome(chrome.storage.sync);

我努力了

js.context['hterm']['defaultStorage'] = 
    new js.JsObject(js.context['lib']['Storage']['Chrome'], js.context['chrome']['storage']['sync']);

但这并没有像我预期的那样工作。也许是因为 js.JsObject 返回 dart 对象。我必须使用JsObject.jsify吗?似乎只jsify接收飞镖对象的集合。

4

1 回答 1

2

我认为它应该这样工作

js.context['hterm']['defaultStorage'] = 
    js.context['lib']['Storage'].callMethod('Chrome', [js.context['chrome']['storage']['sync']]);
于 2014-10-18T08:43:01.980 回答