one
Version:
One is a React framework for web, iOS, and Android apps.
52 lines (50 loc) • 1.31 kB
JavaScript
const IMPACT_STYLES = [
"light",
"medium",
"heavy",
"soft",
"rigid"
];
const NOTIFICATION_TYPES = [
"success",
"warning",
"error"
];
const ANDROID_HAPTICS = [
"clock-tick",
"confirm",
"context-click",
"drag-start",
"gesture-end",
"gesture-start",
"keyboard-press",
"keyboard-release",
"keyboard-tap",
"long-press",
"no-haptics",
"reject",
"segment-frequent-tick",
"segment-tick",
"text-handle-move",
"toggle-off",
"toggle-on",
"virtual-key",
"virtual-key-release"
];
function assertAndroidHaptic(type) {
if (!ANDROID_HAPTICS.includes(type)) {
throw new TypeError(`One.Haptics.performAndroidHaptics: unknown type ${JSON.stringify(type)}. Expected one of: ${ANDROID_HAPTICS.join(", ")}.`);
}
}
function assertImpact(style) {
if (!IMPACT_STYLES.includes(style)) {
throw new TypeError(`One.Haptics.impact: unknown style ${JSON.stringify(style)}. Expected one of: ${IMPACT_STYLES.join(", ")}.`);
}
}
function assertNotification(type) {
if (!NOTIFICATION_TYPES.includes(type)) {
throw new TypeError(`One.Haptics.notification: unknown type ${JSON.stringify(type)}. Expected one of: ${NOTIFICATION_TYPES.join(", ")}.`);
}
}
export { ANDROID_HAPTICS, IMPACT_STYLES, NOTIFICATION_TYPES, assertAndroidHaptic, assertImpact, assertNotification };
//# sourceMappingURL=validation.mjs.map