From c7bb3dde8c9117a1cebfa8f1f575d710f34da8ec Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Wed, 15 Jul 2015 09:49:03 -0700 Subject: [PATCH] streamline index file --- index.js | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/index.js b/index.js index 26b76cb..3b1efd0 100644 --- a/index.js +++ b/index.js @@ -1,36 +1,33 @@ "use strict"; -var Config = require("./lib/config"), - MCP = require("./lib/mcp"), - API = require("./lib/api"); +var MCP = require("./lib/mcp"); -var exports = module.exports = {}; +module.exports = { + MCP: require("./lib/mcp"), -exports.MCP = require("./lib/mcp"); -exports.Robot = require("./lib/robot"); -exports.Driver = require("./lib/driver"); -exports.Adaptor = require("./lib/adaptor"); + Robot: require("./lib/robot"), -exports.Utils = require("./lib/utils"); -exports.Logger = require("./lib/logger"); + Driver: require("./lib/driver"), + Adaptor: require("./lib/adaptor"), -exports.IO = { - DigitalPin: require("./lib/io/digital-pin"), - Utils: require("./lib/io/utils") + Utils: require("./lib/utils"), + Logger: require("./lib/logger"), + + IO: { + DigitalPin: require("./lib/io/digital-pin"), + Utils: require("./lib/io/utils") + }, + + robot: MCP.create, + api: require("./lib/api").create, + config: require("./lib/config").update, + + start: MCP.start, + halt: MCP.halt }; -exports.robot = MCP.create; -exports.start = MCP.start; -exports.halt = MCP.halt; - -exports.api = API.create; - -exports.config = Config.update; - process.on("SIGINT", function() { - exports.halt(function() { - process.kill(process.pid); - }); + MCP.halt(process.kill.bind(process, process.pid)); }); if (process.platform === "win32") {