A Google Chrome browser on Windows, macOS or Linux 64 bit.
This demonstrates bridging JavaScript to the native platform using cross-platform technologies. To get detailed informations about the full stack: https://github.com/frederiksen/chrome-platform-bridge
Checks if the required prerequisites has been setup
Get OS name and version
const platformBridge = new ChromePlatformBridge();
const result = await platformBridge.invoke({method:"example1"});
var osNameAndVersion = System.Runtime.InteropServices.RuntimeInformation.OSDescription;
return osNameAndVersion;
-
Create a new file on the desktop
const platformBridge = new ChromePlatformBridge();
const result = await platformBridge.invoke({method:"example2", filename: "text.txt", text:"Message from the Chrome browser: Hello world"});
var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var fullPath = Path.Combine(folderPath, filename);
using (var outputFile = new StreamWriter(fullPath))
{
await outputFile.WriteLineAsync(text);
}
return fullPath;
-