// Generated by CoffeeScript 1.7.1
(function() {
  var Module, fs, globalPaths, path, process, timers, wrapWithActivateUvLoop;

  process = global.process;

  fs = require('fs');

  path = require('path');

  timers = require('timers');

  Module = require('module');

  process.atomBinding = function(name) {
    var e;
    try {
      return process.binding("atom_" + process.type + "_" + name);
    } catch (_error) {
      e = _error;
      if (/No such module/.test(e.message)) {
        return process.binding("atom_common_" + name);
      }
    }
  };

  globalPaths = Module.globalPaths;

  globalPaths.push(path.join(process.resourcesPath, 'atom', 'common', 'api', 'lib'));

  wrapWithActivateUvLoop = function(func) {
    return function() {
      process.activateUvLoop();
      return func.apply(this, arguments);
    };
  };

  process.nextTick = wrapWithActivateUvLoop(process.nextTick);

  global.setImmediate = wrapWithActivateUvLoop(timers.setImmediate);

  global.clearImmediate = timers.clearImmediate;

  if (process.type === 'browser') {
    global.setTimeout = wrapWithActivateUvLoop(timers.setTimeout);
    global.setInterval = wrapWithActivateUvLoop(timers.setInterval);
  }

}).call(this);
