Skip to content

Commit 0375c13

Browse files
committed
Merge pull request #8 from solidusjs/add-server-logs
Add server logs
2 parents af6a20d + f920f3b commit 0375c13

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ A Google Chrome developer tools extension for use by [Solidus](https://github.co
22

33
**Note:** This is still a work in progress, use at your own risk.
44

5+
#Build
6+
* Clone the repo with `git clone https://github.com/solidusjs/devtools-solidus.git devtools-solidus`
7+
* Run `npm install` to install dependencies
8+
* (Optional) Chrome will complain about `.pem` files in some of the dependencies, so you can manually delete `node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/test/` to prevent Chrome from warning you when you install the extension.
9+
510
#Installation
611
* Open chrome://extensions
712
* Enable 'Developer Mode' checkbox

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"grunt-contrib-uglify": "~0.4.0"
3030
},
3131
"dependencies": {
32-
"Inspector-JSON": "SparkartGroupInc/Inspector-JSON"
32+
"Inspector-JSON": "SparkartGroupInc/Inspector-JSON",
33+
"socket.io-client": "^1.0.6"
3334
}
3435
}

views/devpanel.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<!doctype html>
22
<html>
33
<head>
4+
<script src="../node_modules/socket.io-client/socket.io.js"></script>
45
<script src="devpanel.js"></script>
56
<script src="../node_modules/inspector-json/inspector-json.js"></script>
67
<link href="../node_modules/inspector-json/inspector-json.css" media="all" rel="stylesheet" type="text/css">
78
</head>
89
<body>
910
<div id="messageholder"></div>
1011
<div id="pagecontext"></div>
12+
<pre id="serverlogs"></pre>
1113
</body>
1214
</html>

views/devpanel.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
// Tell JSHint that processMainIncomingMessage is definedhere but used elsewhere
77
/* exported processMainIncomingMessage */
8+
// Tell JSHint about the socket.io global
9+
/* global io */
810

911
var inspector;
1012

@@ -35,3 +37,13 @@ function displayMessage(msg) {
3537
document.querySelector('#messageholder').innerHTML = msg;
3638
console.log('Updated Panel With Message', msg);
3739
}
40+
41+
var socket = io('http://localhost:8081');
42+
socket.on('connect', function(){
43+
socket.on('log', function(data){
44+
document.querySelector('#serverlogs').innerHTML += data.message + '\n';
45+
});
46+
socket.on('disconnect', function(){
47+
document.querySelector('#serverlogs').innerHTML = 'Socket Disconnected';
48+
});
49+
});

0 commit comments

Comments
 (0)