-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
347ed2c
commit 8404e8f
Showing
10 changed files
with
88 additions
and
49 deletions.
There are no files selected for viewing
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
var chompTestInspector = {}; |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
var Init = { | |||
messageService: function(){ | |||
state.ws = WebSocketService.create('/'); | |||
MessageService.attach(state.ws); | |||
} | |||
}; | |||
|
|||
$(document).ready(function () { | |||
Init.messageService(); | |||
}); |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
// Export the applicatoin to a CommonJS module if exports is available | |||
if (typeof(exports) !== "undefined" && exports !== null) | |||
exports.module = chompTestInspector; | |||
return chompTestInspector; | |||
})(); |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
/* | |||
* chomp-test-inspector-client.js - Test inspector for chomp (continuous integration, fully reactive) | |||
* Copyright (C) Rehno Lindeque. | |||
*/ | |||
var chompTestInspector = (function() { | |||
"use strict"; |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1 +1,20 @@ | |||
// TODO: message.js | var | ||
Message = adt('Acknowledge','Notify','ReloadFiles','PatchFile', 'ParseError'), | |||
|
|||
evalMessage = adt({ | |||
Acknowledge: function() { console.log("...previous message acknowledged"); }, | |||
Notify: function(notification) { console.log("...notification:", notification); }, | |||
ReloadFiles: function(files) { | |||
console.log("...reload files: ", files); | |||
}, | |||
PatchFile: function(filePath, patch) { | |||
console.log("...apply patch to file: ", file); | |||
console.log("...patch: ", patch); | |||
}, | |||
ParseError: function(message) { console.error("...previous message this client sent could not be parsed: \n", message); }, | |||
_: function() { console.error("...(error) unknown message type `" + this._tag + "`" ); } | |||
}), | |||
|
|||
sendMessage = function(ws, message) { | |||
ws.send(adt.serialize(message)); | |||
}; |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
var MessageService = { | |||
// Attach to a websocket | |||
attach: function (ws) { | |||
if (ws == null) | |||
return; | |||
ws.onopen = function() { | |||
//sendMessage(ws, "Message from client"); | |||
// TODO: do something meaningful here | |||
}; | |||
ws.onmessage = function(event) { | |||
console.log("Message received..."); | |||
console.log("...event: ", event); | |||
evalMessage(adt.deserialize(event.data)); | |||
}; | |||
} | |||
}; |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
var state = { | |||
ws: null | |||
}; |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,12 @@ | |||
// Websocket service | |||
var WebSocketService = { | |||
// Create a websocket | |||
create: function(path) { | |||
var host = window.location.hostname; | |||
if(host == '') host = 'localhost'; | |||
var uri = 'ws://' + host + ':8080' + path; | |||
var Socket = 'MozWebSocket' in window ? MozWebSocket : WebSocket; | |||
var ws = new Socket(uri); | |||
return ws; | |||
} | |||
}; |
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