Calendarth
Fetch a Public Google Calendar with AJAX
A helper library that fetches and parses a public Google Calendar using the Google API v3.
This package requires jQuery to exist in the global namespace as $
, hopefully future versions will decouple this dependency, pull requests welcome.
Install
bower install calendarth --save
Documentation
You can access Calendarth using the globally available variable calendarth
or as a browserify module. Here's how you can get a new Calendarth instance by invoking the global:
var calendarth = window.calendarth({
calendarId: 'xxx',
appId: 'xxx',
});
Look into the build/
folder for available modular and global exposing builds.
Calendarth Options
When initializing a new Calendarth Object you may pass the following options:
calendarId
Type: string
required The Calendar's Id, looks like this: djasldj23ljd23dj23ldj2%40group.calendar.google.com
appId
Type: string
required The Google API app id.maxResults
Type: number
Default: 20 Maximum results to fetch.
Calendarth Methods
calendarth.fetch(cb)
Fetches the entries of the calendar. Accepts a node style callback:
var cal = calendarth();
cal.fetch(function(err, calendarObj) {
err === null;
typeof calendarObj === 'object';
});
The returned Object is the raw Data Object as passed from the Google Calendar Api v3, you can view a beautified object in this wiki page.
Release History
- v0.0.2, 9 Apr 2014
- Published to NPM.
- Now exposes a modular build too.
- v0.0.1, 8 Apr 2014
License
Copyright 2013 Thanasis Polychronakis
Licensed under the MIT License