feat(app): add recorded artifact gallery to the native run detail
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import 'dart:js_interop';
|
||||
import 'dart:js_interop_unsafe';
|
||||
|
||||
/// Web external open: a new browser tab. The url is already validated by
|
||||
/// [resolveArtifactUrl]; it is passed through unchanged and never fetched.
|
||||
///
|
||||
/// `window.open` is reached through `js_interop` rather than `dart:html`, so the
|
||||
/// same source compiles for both the JavaScript and WebAssembly web targets.
|
||||
Future<bool> openArtifactExternally(Uri uri) async {
|
||||
try {
|
||||
final opened = globalContext.callMethod(
|
||||
'open'.toJS,
|
||||
uri.toString().toJS,
|
||||
'_blank'.toJS,
|
||||
);
|
||||
return opened.isDefinedAndNotNull;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user