-
Notifications
You must be signed in to change notification settings - Fork 162
Migration Guide: v5 → v6
Sebastian edited this page Oct 19, 2023
·
4 revisions
In version 6 some breaking changes were made to make ical-generator
even better. For more details on why these changes were made, check out these tickets:
- https://github.com/sebbo2002/ical-generator/issues/344
- https://github.com/sebbo2002/ical-generator/issues/467
- https://github.com/sebbo2002/ical-generator/issues/478
- https://github.com/sebbo2002/ical-generator/issues/511
- https://github.com/sebbo2002/ical-generator/issues/517
- https://github.com/sebbo2002/ical-generator/issues/519
// with Promises
await cal.save(path);
// with Callback
cal.save(path, err => {});
// Sync
cal.saveSync(path);
// with Promises
import { writeFile } from 'node:fs/promises';
await writeFile(path, cal.toString());
// with Callback
import { writeFile } from 'node:fs';
writeFile(path, cal.toString(), err => {});
// Sync
import { writeFileSync } from 'node:fs';
writeFileSync(path, cal.toString());
cal.serve(res);
res.writeHead(200, {
'Content-Type': 'text/calendar; charset=utf-8',
'Content-Disposition': 'attachment; filename="calendar.ics"'
});
res.end(this.toString());
const blob = cal.toBlob();
const blob = new Blob([cal.toString()], {type: 'text/calendar'});
const url = cal.toURL();
const url = URL.createObjectURL(
new Blob([cal.toString()], {type: 'text/calendar'})
);
const alarm = event.createAlarm({
repeat: 4,
interval: 2
});
const alarm = event.createAlarm({
repeat: {
times: 4,
interval: 2
}
});
const alarm = event.createAlarm({
repeat: 4,
interval: 2
});
const alarm = event.createAlarm({
repeat: {
times: 4,
interval: 2
}
});
const attendee = event.createAttendee(); // ← Attendee.email would be undefined
attendee.email('mail@example.com');
const attendee = event.createAttendee({ email: 'mail@example.com' });
const category = event.createCategory(); // ← Category.name would be undefined
category.name('APPOINTMENT');
const category = event.createCategory({ name: 'APPOINTMENT' });