1import { UnavailabilityError } from 'expo-modules-core';
2
3import BackgroundNotificationTasksModule from './BackgroundNotificationTasksModule.native';
4
5/**
6 * Used to unregister tasks registered with `registerTaskAsync` method.
7 * @param taskName The string you passed to `registerTaskAsync` as the `taskName` parameter.
8 * @header inBackground
9 */
10export default async function unregisterTaskAsync(taskName: string): Promise<null> {
11  if (!BackgroundNotificationTasksModule.unregisterTaskAsync) {
12    throw new UnavailabilityError('Notifications', 'unregisterTaskAsync');
13  }
14
15  return await BackgroundNotificationTasksModule.unregisterTaskAsync(taskName);
16}
17