From aafb7852373222dc975ccdb5f4ecf887898a3e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2EFernando=20S=C3=A1nchez?= Date: Thu, 1 Mar 2012 16:04:36 +0100 Subject: [PATCH] Initial commit --- bin/calendar | 13 +++++++++++++ lib/calendar.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 23 +++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 bin/calendar create mode 100644 lib/calendar.js create mode 100644 package.json diff --git a/bin/calendar b/bin/calendar new file mode 100644 index 0000000..c138b7e --- /dev/null +++ b/bin/calendar @@ -0,0 +1,13 @@ +#!/usr/bin/env node + +var Hook = require('../lib/calendar').CalendarHook; + +var hook = new Hook({ + name: "calendar" +}); + + +// Hook.start defaults to localhost +// it can accept dnode constructor options ( for remote connections ) +// these hooks can be started on diffirent machines / networks / devices +hook.start(); diff --git a/lib/calendar.js b/lib/calendar.js new file mode 100644 index 0000000..2fe693d --- /dev/null +++ b/lib/calendar.js @@ -0,0 +1,46 @@ +// The modules this hook requires +var Hook = require('hook.io').Hook, + util = require('util'), + calendarModule = require('calendar'); + +// Things we need to access in different functions + +// Set up the hook, and export it at the same time +var CalendarHook = exports.CalendarHook = function(options) { + var self = this; + Hook.call(self, options); // Basic initializations + self.config.use('file', { file: './config.json'}); + + // Register callback for hook::ready event + self.on('hook::ready', function() { + // When hook is ready, register callbacks for boxcar events + self.on('*::addEvent', function(data) { + self.addEvent(data); + }); + self.on('*::delEvent', function(data) { + self.delEvent(data); + }); + self.on('*::checkEvent', function(data) { + self.checkEvent(data); + }); + self.on('*::editEvent', function(data) { + self.editEvent(data); + }); + }); + +}; + +// Set up inheritance from Hook +util.inherits(CalendarHook, Hook); + +// Callbacks defined below + +CalendarHook.prototype.addEvent = function(options){ +}; +CalendarHook.prototype.delEvent = function(options){ + +}; +CalendarHook.prototype.checkEvent = function(options){ +}; +CalendarHook.prototype.editEvent = function(options){ +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..4d08b4f --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "author": "J.Fernando Sánchez ", + "name": "hook.io-calendar", + "description": "Hook for calendar integration", + "keywords" : [ "hook", "hook.io", "calendar" ], + "version": "0.0.1", + "bugs" : { "url" : "http://github.com/balkian" }, + "repository": { + "type": "git", + "url": "git://github.com/balkian/hookio-calendar.git" + }, + "bin": { + "hookio-calendar": "./bin/calendar" + }, + "main": "./lib/calendar", + "engines": { + "node": ">= v0.4.7" + }, + "dependencies": { + "hook.io" : "0.8.x" + }, + "devDependencies": {} +}