mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-12 18:56:31 +08:00
407 lines
18 KiB
JavaScript
407 lines
18 KiB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
};
|
|
var plugin_1 = require('./plugin');
|
|
/**
|
|
* This plugin allows you to add events to the Calendar of the mobile device.
|
|
*
|
|
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
|
|
*
|
|
*/
|
|
var Calendar = (function () {
|
|
function Calendar() {
|
|
}
|
|
/**
|
|
* Create a calendar. (iOS only)
|
|
*
|
|
* @usage
|
|
* ```
|
|
* Calendar.createCalendar('MyCalendar').then(
|
|
* (msg) => { console.log(msg); },
|
|
* (err) => { console.log(err); }
|
|
* );
|
|
* ```
|
|
*
|
|
* @param {string | Object} nameOrOptions either a string name or a options object.
|
|
* options:
|
|
* calendarName: string the name of the calendar
|
|
* calendarColor: string the hex color of the calendar
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.createCalendar = function (nameOrOptions) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Delete a calendar. (iOS only)
|
|
*
|
|
* @usage
|
|
* ```
|
|
* Calendar.deleteCalendar('MyCalendar').then(
|
|
* (msg) => { console.log(msg); },
|
|
* (err) => { console.log(err); }
|
|
* );
|
|
* ```
|
|
*
|
|
* @param {string} name Name of the calendar to delete.
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.deleteCalendar = function (name) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Returns the default calendar options.
|
|
*
|
|
* @return Returns an object with the default calendar options
|
|
* ```
|
|
* {
|
|
* firstReminderMinutes: 60,
|
|
* secondReminderMinutes: null,
|
|
* recurrence: null, // options are: 'daily', 'weekly', 'monthly', 'yearly'
|
|
* recurrenceInterval: 1, // only used when recurrence is set
|
|
* recurrenceEndDate: null,
|
|
* calendarName: null,
|
|
* calendarId: null,
|
|
* url: null
|
|
* }
|
|
* ```
|
|
*/
|
|
Calendar.getCalendarOptions = function () {
|
|
return {
|
|
firstReminderMinutes: 60,
|
|
secondReminderMinutes: null,
|
|
recurrence: null,
|
|
recurrenceInterval: 1,
|
|
recurrenceEndDate: null,
|
|
calendarName: null,
|
|
calendarId: null,
|
|
url: null
|
|
};
|
|
};
|
|
/**
|
|
* Silently create an event.
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.createEvent = function (title, location, notes, startDate, endDate) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Silently create an event with additional options.
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.createEventWithOptions = function (title, location, notes, startDate, endDate, options) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Interactively create an event.
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.createEventInteractively = function (title, location, notes, startDate, endDate) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Interactively create an event with additional options.
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.createEventInteractivelyWithOptions = function (title, location, notes, startDate, endDate, options) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
// deprecated
|
|
// @Cordova()
|
|
// static createEventInNamedCalendar(
|
|
// title?: string,
|
|
// location?: string,
|
|
// notes?: string,
|
|
// startDate?: Date,
|
|
// endDate?: Date,
|
|
// calendarName?: string
|
|
// ) {}
|
|
/**
|
|
* Find an event.
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.findEvent = function (title, location, notes, startDate, endDate) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Find an event with additional options.
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
|
* @return Returns a Promise that resolves with the event, or rejects with an error.
|
|
*/
|
|
Calendar.findEventWithOptions = function (title, location, notes, startDate, endDate, options) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Find a list of events within the specified date range. (Android only)
|
|
*
|
|
* @param {Date} [startDate] The start date
|
|
* @param {Date} [endDate] The end date
|
|
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
|
|
*/
|
|
Calendar.listEventsInRange = function (startDate, endDate) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Get a list of all calendars.
|
|
* @return A Promise that resolves with the list of calendars, or rejects with an error.
|
|
*/
|
|
Calendar.listCalendars = function () {
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Get a list of all future events in the specified calendar. (iOS only)
|
|
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
|
|
*/
|
|
Calendar.findAllEventsInNamedCalendar = function (calendarName) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Modify an event. (iOS only)
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @param {string} [newTitle] The new event title
|
|
* @param {string} [newLocation] The new event location
|
|
* @param {string} [newNotes] The new event notes
|
|
* @param {Date} [newStartDate] The new event start date
|
|
* @param {Date} [newEndDate] The new event end date
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.modifyEvent = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Modify an event with additional options. (iOS only)
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @param {string} [newTitle] The new event title
|
|
* @param {string} [newLocation] The new event location
|
|
* @param {string} [newNotes] The new event notes
|
|
* @param {Date} [newStartDate] The new event start date
|
|
* @param {Date} [newEndDate] The new event end date
|
|
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.modifyEventWithOptions = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate, options) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Delete an event.
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.deleteEvent = function (title, location, notes, startDate, endDate) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Delete an event from the specified Calendar. (iOS only)
|
|
*
|
|
* @param {string} [title] The event title
|
|
* @param {string} [location] The event location
|
|
* @param {string} [notes] The event notes
|
|
* @param {Date} [startDate] The event start date
|
|
* @param {Date} [endDate] The event end date
|
|
* @param {string} calendarName
|
|
* @return Returns a Promise
|
|
*/
|
|
Calendar.deleteEventFromNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
/**
|
|
* Open the calendar at the specified date.
|
|
* @return {Date} date
|
|
*/
|
|
Calendar.openCalendar = function (date) {
|
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
|
// knows that the correct return type is Promise, because there's no way
|
|
// for it to know the return type from a decorator.
|
|
// See https://github.com/Microsoft/TypeScript/issues/4881
|
|
return new Promise(function (res, rej) { });
|
|
};
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "createCalendar", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "deleteCalendar", null);
|
|
__decorate([
|
|
plugin_1.Cordova({
|
|
sync: true
|
|
})
|
|
], Calendar, "getCalendarOptions", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "createEvent", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "createEventWithOptions", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "createEventInteractively", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "createEventInteractivelyWithOptions", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "findEvent", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "findEventWithOptions", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "listEventsInRange", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "listCalendars", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "findAllEventsInNamedCalendar", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "modifyEvent", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "modifyEventWithOptions", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "deleteEvent", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "deleteEventFromNamedCalendar", null);
|
|
__decorate([
|
|
plugin_1.Cordova()
|
|
], Calendar, "openCalendar", null);
|
|
Calendar = __decorate([
|
|
plugin_1.Plugin({
|
|
name: 'Calendar',
|
|
plugin: 'cordova-plugin-calendar',
|
|
pluginRef: 'plugins.calendar'
|
|
})
|
|
], Calendar);
|
|
return Calendar;
|
|
})();
|
|
exports.Calendar = Calendar;
|
|
//# sourceMappingURL=calendar.js.map
|