The scheduler provides two primary methods for processing reviews:
repeat(card, date): Use this to preview all four possible outcomes (Again, Hard, Good, Easy) before a user makes a choice. It returns an object containing the resulting cards for each rating.next(card, date, rating, [afterHandler]): Use this when the rating is already known. It returns the new card state and a review log.
You can provide an afterHandler to next() to transform the card and log objects into your own storage format (e.g., converting Dates to timestamps).
// Previewing
const preview = scheduler.repeat(card, new Date())
// Applying with a custom handler for storage mapping
const saved = scheduler.next(card, new Date(), Rating.Good, ({ card, log }) => ({
card: {
...card,
due: card.due.getTime(),
last_review: card.last_review?.getTime() ?? null,
},
log: {
...log,
due: log.due.getTime(),
review: log.review.getTime(),
},
}))