CB-8661 Return executed script result on Windows

This commit is contained in:
Vladimir Kotikov 2015-03-24 18:11:28 +03:00
parent c85cab15b7
commit 16353c3466
2 changed files with 12 additions and 2 deletions

View File

@ -349,6 +349,10 @@ The function is passed an `InAppBrowserEvent` object.
- only __code__ key is supported.
### Windows Quirks
Due to [MSDN docs](https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.webview.invokescriptasync.aspx) the invoked script can return only string values, otherwise the parameter, passed to __callback__ will be `[null]`.
## insertCSS
> Injects CSS into the `InAppBrowser` window.

View File

@ -242,7 +242,10 @@ var IAB = {
if (isWebViewAvailable && browserWrap && popup) {
var op = popup.invokeScriptAsync("eval", code);
op.oncomplete = function () { hasCallback && win([]); };
op.oncomplete = function (e) {
var result = [e.target.result];
hasCallback && win(result);
};
op.onerror = function () { };
op.start();
}
@ -261,7 +264,10 @@ var IAB = {
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done(function (file) {
Windows.Storage.FileIO.readTextAsync(file).done(function (code) {
var op = popup.invokeScriptAsync("eval", code);
op.oncomplete = function () { hasCallback && win([]); };
op.oncomplete = function(e) {
var result = [e.target.result];
hasCallback && win(result);
};
op.onerror = function () { };
op.start();
});