-
-
Save RobertBouillon/de2aca0fd6bd7d05f97abccd460ad377 to your computer and use it in GitHub Desktop.
Blazor IPC for Chromely (JS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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