<commit_before>var express = require('express');
var app = express();
var http = require('http').Server(app);
var util = require('util');
var io = require('socket.io')(http);
var root = require('../root');

var Web = function(drawbot) {
  app.use(express.static(root.web + '/public_html/assets'));

  app.get('/', function (req, res) {
    res.sendFile(root.web + '/public_html/index.html');
  });

  io.on('connection', function(socket) {
    drawbot.on('log', function(data, err) {
      socket.emit('log', data.string, err);
    });

    if(drawbot.isSerialConnected) {
      socket.emit('drawbot connected');
    }

    drawbot.on('connected', function() {
      console.log('web.js connected')
      socket.emit('drawbot connected');
    });
    drawbot.on('disconnected', function() {
      socket.emit('drawbot disconnected');
    });

    drawbot.getSerialPortList(function(ports) {
      socket.emit('serial-list', ports);
    });

    socket.on('drawbot connect', function(data) {
      drawbot.connect(data.port);
    });

    socket.on('drawbot disconnect', function(data) {
      drawbot.disconnect();
    });

    socket.on('drawbot write', function(data) {
      drawbot.write(data.string);
    });

    socket.on('drawbot jog', function(data) {<commit_msg>bugfix events<commit_after>var express = require('express');
var app = express();
var http = require('http').Server(app);
var util = require('util');
var io = require('socket.io')(http);
var root = require('../root');

var Web = function(drawbot) {
  app.use(express.static(root.web + '/public_html/assets'));

  app.get('/', function (req, res) {
    res.sendFile(root.web + '/public_html/index.html');
  });

  io.on('connection', function(socket) {
    drawbot.on('log', function(data, err) {
      socket.emit('log', data.string, err);
    });

    if(drawbot.isSerialConnected) {
      console.log('web.js connected');
      socket.emit('drawbot connected');
    }

    drawbot.on('connected', function() {
      socket.emit('drawbot connected');
    });
    drawbot.on('disconnected', function() {
      socket.emit('drawbot disconnected');
    });

    drawbot.getSerialPortList(function(ports) {
      socket.emit('serial-list', ports);
    });

    socket.on('drawbot connect', function(data) {
      drawbot.connect(data.port);
    });

    socket.on('drawbot disconnect', function(data) {
      drawbot.disconnect();
    });

    socket.on('drawbot write', function(data) {
      drawbot.write(data.string);
    });

    socket.on('drawbot jog', function(data) {
{'fraction_non_alphanumeric': 0.187426326129666, 'fraction_numerical': 0.0, 'mean_word_length': 3.498233215547703, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6380290', 'n_tokens_mistral': 815, 'n_tokens_neox': 792, 'n_words': 137}