<commit_before>/* jshint node:true */
'use strict';

// based on the sender side of https://github.com/openflint/audio-visualizer-sample

var DeviceManager = require('../').DeviceManager;

var appID = '~audio-visualizer';
var appURL = 'http://openflint.github.io/audio-visualizer-sample/receiver_app/index.html';

var device = {
  applicationUrl: 'http://localhost:9431/apps',
  name: 'MatchStick_MAC_a474',
  model: 'MatchStick'
};
var manager = manager = new DeviceManager(device);
manager.appID = appID;

manager.on('launch', function () {
  // quit after 30 seconds
  setTimeout(function () {
    manager.quitApp();
  }, 30 * 1000);
});
manager.on('quit', function () {
  console.log('app quit');
  process.exit(0);
});
manager.on('error', function (err) {
  console.error('ERROR - DeviceManager failure:', err);
  process.exit(1);
});
manager.on('channel', function (channel) {
  channel.on('open', function () {
    console.log('channel opened');

    var data = JSON.stringify({
      'type': 'PLAY',
      'effect': 'wave',
      'url': 'http://openflint.github.io/audio-visualizer-sample/receiver_app/audio/EMDCR.ogg'
    });
    channel.send(data, function (err) {
      if (err) {
        console.error('ERROR - channel send failed:', err);
        return;
      }

      // success
    });
  });
  channel.on('close', function () {
    console.log('channel closed');
  });
  channel.on('error', function (err) {
    console.error('ERROR - MessageChannel failure:', err);
  });
  channel.on('message', function (data) {
    console.log('received message:', data);
  });
});

manager.launchApp(appURL, {messageChannel: true});
<commit_msg>clean up object properties<commit_after>/* jshint node:true */
'use strict';

// based on the sender side of https://github.com/openflint/audio-visualizer-sample

var DeviceManager = require('../').DeviceManager;

var appID = '~audio-visualizer';
var appURL = 'http://openflint.github.io/audio-visualizer-sample/receiver_app/index.html';

var device = {
  applicationUrl: 'http://localhost:9431/apps',
  name: 'MatchStick_MAC_a474',
  model: 'MatchStick'
};
var manager = manager = new DeviceManager(device);
manager.appID = appID;

manager.on('launch', function () {
  // quit after 30 seconds
  setTimeout(function () {
    manager.quitApp();
  }, 30 * 1000);
});
manager.on('quit', function () {
  console.log('app quit');
  process.exit(0);
});
manager.on('error', function (err) {
  console.error('ERROR - DeviceManager failure:', err);
  process.exit(1);
});
manager.on('channel', function (channel) {
  channel.on('open', function () {
    console.log('channel opened');

    var data = JSON.stringify({
      type: 'PLAY',
      effect: 'wave',
      url: 'http://openflint.github.io/audio-visualizer-sample/receiver_app/audio/EMDCR.ogg'
    });
    channel.send(data, function (err) {
      if (err) {
        console.error('ERROR - channel send failed:', err);
        return;
      }

      // success
    });
  });
  channel.on('close', function () {
    console.log('channel closed');
  });
  channel.on('error', function (err) {
    console.error('ERROR - MessageChannel failure:', err);
  });
  channel.on('message', function (data) {
    console.log('received message:', data);
  });
});

manager.launchApp(appURL, {messageChannel: true});

{'fraction_non_alphanumeric': 0.1821482602118003, 'fraction_numerical': 0.010287443267776097, 'mean_word_length': 3.643258426966292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3801538', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1056, 'n_words': 217}