Chrome Platform Bridge Demo App

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

Preflight check

Checks if the required prerequisites has been setup


Example 1:

Get OS name and version

JavaScript

const platformBridge = new ChromePlatformBridge();
const result = await platformBridge.invoke({method:"example1"});

C#

var osNameAndVersion = System.Runtime.InteropServices.RuntimeInformation.OSDescription;
return osNameAndVersion;

Return value

-


Example 2:

Create a new file on the desktop

JavaScript

const platformBridge = new ChromePlatformBridge();
const result = await platformBridge.invoke({method:"example2", filename: "text.txt", text:"Message from the Chrome browser: Hello world"});

C#

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;

filename
text
Return value

-