Skip to content

Instantly share code, notes, and snippets.

@RobertBouillon
Created January 26, 2021 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertBouillon/de2aca0fd6bd7d05f97abccd460ad377 to your computer and use it in GitHub Desktop.
Save RobertBouillon/de2aca0fd6bd7d05f97abccd460ad377 to your computer and use it in GitHub Desktop.
Blazor IPC for Chromely (JS)
function isHosted() {
return !(window.cefQuery === undefined);
}
function sendHostCommand(type, body) {
var request = {
"method": "POST",
"url": "/host/command",
"parameters": { "type": type },
"postData": body,
};
window.cefQuery({
request: JSON.stringify(request),
onSuccess: function (response) { },
onFailure: function (err, msg) {
console.log(err, msg);
}
});
}
function sendHostRequest(type, body, callback) {
var request = {
"method": "POST",
"url": "/host/request",
"parameters": { "type": type },
"postData": body,
};
window.cefQuery({
request: JSON.stringify(request),
onSuccess: function (response) { callback(response) },
onFailure: function (err, msg) {
console.log(err, msg);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment