Calendar-PhoneGap-Plugin icon indicating copy to clipboard operation
Calendar-PhoneGap-Plugin copied to clipboard

"deleteCalendar" will trigger nothing when there is no exist "calendarName"

Open bau720123 opened this issue 10 years ago • 6 comments

hi @EddyVerbruggen I am using PGB 5.2.0 with your latest version from npm https://www.npmjs.com/package/cordova-plugin-calendar

this is my full example

var calendarName = "mycalendar";
window.plugins.calendar.deleteCalendar(calendarName, success, error);

well... in iOS 8.4.1 (12H321),if I use "deleteCalendar" when there is already a exist "calendarName ",it will trigger the success callback but... when there is no exist "calendarName",it will trigger "nothing" (it it should be trigger the error callback ?)

bau720123 avatar Aug 24 '15 07:08 bau720123

The error callback is for unexpected runtime trouble IMO, or in case your input is incorrect.

I will change it so that the successcallback returns true in case a calendar was found (and deleted) and false if there was no such calendar.

WDYT?

EddyVerbruggen avatar Aug 24 '15 07:08 EddyVerbruggen

hi @EddyVerbruggen I think...perfect!!! don't be angry,I am just suggestion XD

bau720123 avatar Aug 24 '15 08:08 bau720123

Hey man, I'm not angry at all, this is a very reasonable question and I think that the current implementation could be better :+1: :+1:

EddyVerbruggen avatar Aug 24 '15 08:08 EddyVerbruggen

OKOK thanks @EddyVerbruggen again

bau720123 avatar Aug 24 '15 08:08 bau720123

Is this still in the latest version? I am using ionic 3 and if I do this await this.calendar.deleteCalendar('xxx') It seems it never return

hkjeffchan avatar Nov 02 '18 13:11 hkjeffchan

@hkjeffchan This API doesn't return promises; it calls the success and error functions you supply at the end of the parameters list.

thedewi avatar Nov 04 '18 01:11 thedewi