Namespace messageProxy (sendMessage)

This commit is contained in:
hensm
2019-01-12 09:28:01 +00:00
parent 626b8ca75e
commit 839ea81838
2 changed files with 6 additions and 4 deletions

View File

@@ -67,7 +67,7 @@ window.addEventListener("load", () => {
htmlReporter.initialize(); htmlReporter.initialize();
// Use messageProxy socket to request spec injection // Use messageProxy socket to request spec injection
window.sendMessage({ messageProxy.sendMessage({
subject: "injectSpecs" subject: "injectSpecs"
}); });
}); });

View File

@@ -3,8 +3,10 @@
// Create socket connection // Create socket connection
const socket = new WebSocket("ws://localhost:8080"); const socket = new WebSocket("ws://localhost:8080");
window.sendMessage = (message) => { window.messageProxy = {
socket.send(JSON.stringify(message)); sendMessage (message) {
socket.send(JSON.stringify(message));
}
} }
const reporterMethods = [ const reporterMethods = [
@@ -21,7 +23,7 @@ const customReporter = {};
// Populate reporter methods // Populate reporter methods
for (const method of reporterMethods) { for (const method of reporterMethods) {
customReporter[method] = function (result) { customReporter[method] = function (result) {
sendMessage({ messageProxy.sendMessage({
subject: method subject: method
, data: result , data: result
}); });