/*
 * netcheck
 * Will monitor Internet and local network connectivity and inform about their state.
 * https://github.com/INSIGHTReplay/netcheck
 *
 * Copyright ©2015 Insight Replay, Inc.
 * Licensed under the MIT license.
 * @author Thanasis Polychronakis
 */

/**
 * @fileOverview netcheck Base.
 */
var netcheck = module.exports = {};

/**
 * Start the network monitors.
 *
 */
netcheck.init = function() {

};

@@ -259,157 +259,2200 @@
  */%0A
-%0A/**%0A * @fileOverview netcheck Base.%0A */%0Avar netcheck = module.exports = %7B%7D;%0A%0A/**%0A * Start the network monitors.%0A *%0A */%0Anetcheck.init = function() %7B%0A%0A%7D
+var _ = require('lodash');%0Avar Promise = require('bluebird');%0Avar network = require('network');%0Avar isOnline = require('is-online');%0A%0Avar monitor = require('monitor').getInstance();%0A%0A/**%0A * @fileOverview netcheck Base.%0A */%0Avar netcheck = module.exports = %7B%7D;%0A%0Anetcheck.on = monitor.on.bind(monitor);%0Anetcheck.once = monitor.once.bind(monitor);%0Anetcheck.removeListener = monitor.removeListener.bind(monitor);%0Anetcheck.removeAllListener = monitor.removeAllListeners.bind(monitor);%0A%0A/**%0A * Start the network monitors.%0A *%0A */%0Anetcheck.init = function() %7B%0A  monitor.init();%0A%7D;%0A%0A/**%0A * Setup netcheck.%0A *%0A * @param %7BObject%7D options User defined options.%0A */%0Anetcheck.setup = function(options) %7B%0A  _.defaults(options, monitor.options);%0A%7D;%0A%0A/**%0A * Checks if Internet connectivity exists.%0A *%0A * @return %7BPromise(Boolean)%7D A Promise with the boolean result.%0A */%0Anetcheck.hasInternet = Promise.method(function() %7B%0A  if (monitor.isActive) %7B%0A    // Monitor is active, check if tests are complete or wait for them.%0A    if (monitor.internetTestComplete) %7B%0A      return monitor.hasInternet;%0A    %7D else %7B%0A      return new Promise(function(resolve) %7B%0A        monitor.once('internet', function(isConnected) %7B%0A          resolve(isConnected);%0A        %7D);%0A      %7D);%0A    %7D%0A  %7D else %7B%0A    // Monitor is not running, invoke the test here.%0A    return new Promise(function(resolve) %7B%0A      isOnline(function(err, online) %7B%0A        resolve(!!online);%0A      %7D);%0A    %7D);%0A  %7D%0A%7D);%0A%0A/**%0A * Checks if Local Network connectivity exists.%0A *%0A * @return %7BPromise(Boolean)%7D A Promise with the boolean result.%0A */%0Anetcheck.hasLocal = Promise.method(function() %7B%0A  if (monitor.isActive) %7B%0A    // Monitor is active, check if tests are complete or wait for them.%0A    if (monitor.localTestComplete) %7B%0A      return monitor.hasLocal;%0A    %7D else %7B%0A      return new Promise(function(resolve) %7B%0A        monitor.once('local', function(isConnected) %7B%0A          resolve(isConnected);%0A        %7D);%0A      %7D);%0A    %7D%0A  %7D else %7B%0A    // Monitor is not running, invoke the test here.%0A    return new Promise(function(resolve) %7B%0A      /* jshint camelcase:false */%0A      network.get_private_ip(function(err) %7B%0A        resolve(!err);%0A      %7D);%0A    %7D);%0A  %7D%0A%7D)
 ;%0A

Work on the netcheck core