无法在 DART 1.9.3、Polymer 0.16.1+2 中使用 initPolymer().运行
Cannot use initPolymer().run in DART 1.9.3, Polymer 0.16.1+2
我正在尝试升级到 DART 1.9.3、Polymer 0.16.1
之前有效的代码:
initPolymer().run((){
... some code
}
现在报告
"the method run() is not defined for Future<Zone>
"
这是已知的 change/defect 吗?
有什么解决方法?
请指教。
Polymer.dart release notes for 0.16.0 有:
Breaking Changes
The initPolymer() method now returns a Future instead of a Zone. This is not completed until all @HtmlImport imports have finished loading. See the changelog for more information and a few example migration paths.
这表明你应该将你的 ... some code
放在一个名为 realMain()
的函数中,并像这样调用它:
main() => initPolymer().then((zone) => zone.run(realMain));
realMain() => ...
或:
main() => initPolymer();
@initMethod
realMain() => ...
我正在尝试升级到 DART 1.9.3、Polymer 0.16.1
之前有效的代码:
initPolymer().run((){
... some code
}
现在报告
"the method run() is not defined for Future
<Zone>
"
这是已知的 change/defect 吗? 有什么解决方法?
请指教。
Polymer.dart release notes for 0.16.0 有:
Breaking Changes
The initPolymer() method now returns a Future instead of a Zone. This is not completed until all @HtmlImport imports have finished loading. See the changelog for more information and a few example migration paths.
这表明你应该将你的 ... some code
放在一个名为 realMain()
的函数中,并像这样调用它:
main() => initPolymer().then((zone) => zone.run(realMain));
realMain() => ...
或:
main() => initPolymer();
@initMethod
realMain() => ...