emptymodule
This commit is contained in:
parent
e9e67b011c
commit
9fd6293037
@ -1,5 +1,5 @@
|
|||||||
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
||||||
import { EmptyModule, log } from './utils';
|
import { emptyModule, log } from './utils';
|
||||||
const {
|
const {
|
||||||
version: v,
|
version: v,
|
||||||
} = require('react-native/Libraries/Core/ReactNativeVersion');
|
} = require('react-native/Libraries/Core/ReactNativeVersion');
|
||||||
@ -10,7 +10,7 @@ const isTurboModuleEnabled =
|
|||||||
|
|
||||||
export const PushyModule =
|
export const PushyModule =
|
||||||
Platform.OS === 'web'
|
Platform.OS === 'web'
|
||||||
? new EmptyModule()
|
? emptyModule
|
||||||
: isTurboModuleEnabled
|
: isTurboModuleEnabled
|
||||||
? require('./NativePushy').default
|
? require('./NativePushy').default
|
||||||
: NativeModules.Pushy;
|
: NativeModules.Pushy;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { PermissionsAndroidStatic } from 'react-native';
|
import type { PermissionsAndroidStatic } from 'react-native';
|
||||||
import { EmptyModule } from './utils';
|
import { emptyModule } from './utils';
|
||||||
|
|
||||||
export const PermissionsAndroid = new EmptyModule() as PermissionsAndroidStatic;
|
export const PermissionsAndroid = emptyModule as PermissionsAndroidStatic;
|
||||||
|
@ -5,7 +5,7 @@ export function log(...args: any[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
export class EmptyModule {
|
class EmptyModule {
|
||||||
constructor() {
|
constructor() {
|
||||||
return new Proxy(this, {
|
return new Proxy(this, {
|
||||||
get() {
|
get() {
|
||||||
@ -14,6 +14,7 @@ export class EmptyModule {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export const emptyModule = new EmptyModule();
|
||||||
|
|
||||||
const ping =
|
const ping =
|
||||||
Platform.OS === 'web'
|
Platform.OS === 'web'
|
||||||
|
Loading…
Reference in New Issue
Block a user