I would like to know how to print reports on Dart.
Basically, this is the activity flow:
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).
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
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.