How to use the @unimodules/core.UnavailabilityError function in @unimodules/core

To help you get started, we’ve selected a few @unimodules/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo / packages / expo-calendar / src / Calendar.ts View on Github external
export async function updateEventAsync(
  id: string,
  details: Event = {},
  { futureEvents = false, instanceStartDate }: RecurringEventOptions = {}
): Promise<string> {
  if (!ExpoCalendar.saveEventAsync) {
    throw new UnavailabilityError('Calendar', 'updateEventAsync');
  }
  if (!id) {
    throw new Error('updateEventAsync must be called with an id (string) of the target event');
  }

  if (Platform.OS === 'ios') {
    if (
      details.hasOwnProperty('creationDate') ||
      details.hasOwnProperty('lastModifiedDate') ||
      details.hasOwnProperty('originalStartDate') ||
      details.hasOwnProperty('isDetached') ||
      details.hasOwnProperty('status') ||
      details.hasOwnProperty('organizer')
    ) {
      console.warn(
        'updateEventAsync was called with one or more read-only properties, which will not be updated'
github expo / expo / packages / expo-calendar / build / Calendar.js View on Github external
export async function updateEventAsync(id, details = {}, { futureEvents = false, instanceStartDate } = {}) {
    if (!ExpoCalendar.saveEventAsync) {
        throw new UnavailabilityError('Calendar', 'updateEventAsync');
    }
    if (!id) {
        throw new Error('updateEventAsync must be called with an id (string) of the target event');
    }
    if (Platform.OS === 'ios') {
        if (details.hasOwnProperty('creationDate') ||
            details.hasOwnProperty('lastModifiedDate') ||
            details.hasOwnProperty('originalStartDate') ||
            details.hasOwnProperty('isDetached') ||
            details.hasOwnProperty('status') ||
            details.hasOwnProperty('organizer')) {
            console.warn('updateEventAsync was called with one or more read-only properties, which will not be updated');
        }
    }
    const newDetails = { ...details, id, instanceStartDate };
    return ExpoCalendar.saveEventAsync(newDetails, { futureEvents });
github expo / expo / packages / expo-contacts / build / Contacts.js View on Github external
export async function getPermissionsAsync() {
    if (!ExpoContacts.getPermissionsAsync) {
        throw new UnavailabilityError('Contacts', 'getPermissionsAsync');
    }
    return ExpoContacts.getPermissionsAsync();
}
export async function requestPermissionsAsync() {
github expo / expo / packages / expo-print / src / Print.ts View on Github external
export async function selectPrinterAsync(): Promise<Printer> {
  if (ExponentPrint.selectPrinter) {
    return await ExponentPrint.selectPrinter();
  }

  throw new UnavailabilityError('Print', 'selectPrinterAsync');
}
github expo / expo / packages / expo / build / ScreenOrientation / ScreenOrientation.js View on Github external
export async function unlockAsync() {
    if (!ExpoScreenOrientation.unlockAsync) {
        throw new UnavailabilityError('ScreenOrientation', 'unlockAsync');
    }
    await ExpoScreenOrientation.unlockAsync();
}
export async function getOrientationAsync() {
github expo / expo / packages / expo-google-sign-in / build / GoogleSignIn.js View on Github external
export async function initAsync(options) {
    if (!ExpoGoogleSignIn.initAsync) {
        throw new UnavailabilityError('GoogleSignIn', 'initAsync');
    }
    _options = validateOptions(options || _options || {});
    const hasPlayServices = await getPlayServiceAvailability();
    if (!hasPlayServices) {
        return;
    }
    _initialization = ExpoGoogleSignIn.initAsync(_options || {});
    return _initialization;
}
export async function isSignedInAsync() {
github expo / expo / packages / expo-haptics / build / Haptics.js View on Github external
export async function notificationAsync(type = NotificationFeedbackType.Success) {
    if (!ExpoHaptics.notificationAsync) {
        throw new UnavailabilityError('Haptics', 'notificationAsync');
    }
    await ExpoHaptics.notificationAsync(type);
}
/**
github expo / expo / packages / expo-analytics-segment / build / Segment.js View on Github external
export function flush() {
    if (!ExponentSegment.flush) {
        throw new UnavailabilityError('expo-analytics-segment', 'flush');
    }
    ExponentSegment.flush();
}
export async function getEnabledAsync() {
github expo / expo / packages / expo-google-sign-in / build / GoogleSignIn.js View on Github external
async function invokeAuthMethod(method) {
    if (!ExpoGoogleSignIn[method]) {
        throw new UnavailabilityError('GoogleSignIn', method);
    }
    await ensureGoogleIsInitializedAsync();
    const payload = await ExpoGoogleSignIn[method]();
    let account = payload != null ? new GoogleUser(payload) : null;
    return setCurrentUser(account);
}
export function allowInClient() {
github expo / expo / packages / expo-background-fetch / build / BackgroundFetch.js View on Github external
export async function registerTaskAsync(taskName, options = {}) {
    if (!ExpoBackgroundFetch.registerTaskAsync) {
        throw new UnavailabilityError('BackgroundFetch', 'registerTaskAsync');
    }
    if (!TaskManager.isTaskDefined(taskName)) {
        throw new Error(`Task '${taskName}' is not defined. You must define a task using TaskManager.defineTask before registering.`);
    }
    await ExpoBackgroundFetch.registerTaskAsync(taskName, options);
}
export async function unregisterTaskAsync(taskName) {

@unimodules/core

Universal modules core

MIT
Latest version published 1 year ago

Package Health Score

67 / 100
Full package analysis