Dart Language: printing reports

安稳与你 提交于 2019-12-01 12:00:49

Update

Start sending from the report window to window.opener.postMessage(...) and then respond to (message.source as WindowBase).postMessage(...). This is probably a bug with the return value of window.open (see http://dartbug.com/20216 for more details).

Original

The code in this unit test should show you how it can be done https://github.com/dart-lang/core-elements/blob/master/test/core_media_query_test.dart.

I open a window from a new URL that loads its content and a Dart script (can of course also be compiled to JavaScript) from the server. The opened window communicates with the main window by sendMessage. This works in both directions.

Basically the second window is a second Dart browser application.

This might not exactly be what you were looking for but your requirement could realized this way I guess.

At this line https://github.com/dart-lang/core-elements/blob/master/test/core_media_query_test.dart#L66 the commented out code would probably fit for your requirement. I created the workaround below because the code is supposed to resize the second window from code in the main window to test the <core-media-query> element (doesn't work either btw.). But I assume you just need to open the window and the commented out code should do exactly that just fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!