1 |
|
2 |
|
3 |
|
4 | export function platformCheck(parent) {
|
5 | if (__DEV__) {
|
6 | return new Proxy({}, {
|
7 | get(_, prop) {
|
8 | const propPretty = [parent, prop.toString()].join('.');
|
9 | const hintPlatformCheck = __ANDROID__ ? '__IOS__' : '__ANDROID__';
|
10 |
|
11 | const errorMsg = [
|
12 | `Trying to access "${propPretty}" without checking platform first.`,
|
13 | `Hint: Use "${hintPlatformCheck}" to check platform before accessing "${propPretty}".`
|
14 | ].join('\n');
|
15 | throw new Error(errorMsg);
|
16 | },
|
17 | });
|
18 | }
|
19 | return undefined;
|
20 | }
|
21 |
|
\ | No newline at end of file |