Streams server side log messages to the browser and renders them inside your page.
npm install hyperwatch
// just require hyperwatch in order to add a terminal to the browser window
require('hyperwatch')();
require('hyperwatch')({
mini: {
position: 'top right'
, size: '100x100'
, fontSize: 3
}
});
require('hyperwatch')({
mini: {
position: 'bottom left'
, size: '600x100'
, fontSize: 12
}
}
, function () { console.log('terminals have been initialized'); }
);
Pass the server to hyperwatch.
Pass return value of listen
:
var express = require('express')
, app = express()
, hyperwatch = require('hyperwatch');
var config = hyperwatch(app.listen(3000));
Pass http server:
var ecstatic = require('ecstatic')(__dirname + '/static');
var server = http.createServer(ecstatic);
server.listen(3000);
var config = hyperwatch(server);
Calling hyperwatch(server)
initializes and enables hyperwatch and returns a config
object with the following functions:
config.disable
Invoking config.disable()
will stop data to be streamed to the client and hide the mini terminal when the browser
is refreshed.
config.enable
Invoking config.enable()
will resume data to be streamed to the client and show the mini terminal when the browser
is refreshed.
config.scrollback
Specifies the number of log messages that will be preserved between browser refreshes. The default is 10,000
. Keep in
mind that this data is kept in memory when setting this to very high values.
Toggles full size Terminal
Make it jump from left to right and vice versa in case it gets in your way
npm explore hyperwatch && npm run demo
Then open localhost:3000.