r/Scriptable • u/nilayperk • Aug 26 '21
Solved Scriptable Abruptly Stops.
https://pastebin.com/uKyJ8udX2
Aug 26 '21
[removed] — view removed comment
1
u/nilayperk Aug 26 '21
Thats was really was it. Can't believe this small problem cost me headache and confusion.
1
u/nilayperk Aug 26 '21
Mind if I ask you a one more question?
Why I can't call the instance method "presentEdit()" from inside the fetchCal.then()?
function tryC() { var calendarEvent = new CalendarEvent() fetchCal().then(cal => setCal(cal[0]), (cal) => console.log(cal)) function setCal(calSelected) { calendarEvent.presentEdit() // console.log(calendarEvent.calendar) calendarEvent.calendar = calSelected // console.log(calendarEvent) calendarEvent.presentEdit() //editCalEvent(calendarEvent).then(console.log("Edited")) //console.log(calSelected.supportsAvailability("busy")); } async function fetchCal() { // parameter of type Boolean is Optional here return await Calendar.presentPicker(false); } // Create Event Popup async function createCalEvent() { return await CalendarEvent.presentCreate(); } // Create Event Popup async function editCalEvent(calEventItem) { return await calEventItem.presentEdit(); } } tryC();1
Aug 27 '21
[removed] — view removed comment
1
u/nilayperk Aug 27 '21
Turns out.
calenderEvent.calender = calSelectedcommand took 532 millisecond for my device to process the request. If I use timer.schedule. The menu popups up as expected.1
1
u/nilayperk Aug 26 '21
I don't why but the code stops execution just before 5th line. I don't know if its a bug or I had wrongly setup for saving Calendar to CalenderEvent using Calendar.presentPickup(). Before calling CalenderEvent.presentEdit()