@onepercentio/one-ui 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__test__/utils.d.ts +0 -1
- package/dist/__test__/utils.js +3 -35
- package/dist/__test__/utils.js.map +1 -1
- package/dist/components/AdaptiveButton/AdaptiveButton.js +8 -2
- package/dist/components/AdaptiveButton/AdaptiveButton.js.map +1 -1
- package/dist/components/AdaptiveButton/AdaptiveButton.module.scss +2 -1
- package/dist/components/AdaptiveButton/AdaptiveButton.stories.js +1 -1
- package/dist/components/AdaptiveButton/AdaptiveButton.stories.js.map +1 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.d.ts +6 -2
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +10 -7
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js.map +1 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +2 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.stories.d.ts +3 -2
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js +1 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js.map +1 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.module.scss +1 -0
- package/dist/components/EmailInput/EmailInput.d.ts +4 -2
- package/dist/components/EmailInput/EmailInput.stories.d.ts +4 -2
- package/dist/components/Form/Form.d.ts +14 -8
- package/dist/components/Form/Form.js +11 -1
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Input/Input.d.ts +7 -3
- package/dist/components/Input/Input.js +2 -1
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.module.scss +1 -0
- package/dist/components/Input/Input.stories.d.ts +3 -1
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +5 -2
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -1
- package/dist/components/Select/Select.stories.d.ts +6 -2
- package/dist/components/Text/Text.js +1 -1
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/Transition/Transition.d.ts +3 -2
- package/dist/components/Transition/Transition.js +19 -3
- package/dist/components/Transition/Transition.js.map +1 -1
- package/dist/components/Transition/Transition.module.scss +58 -5
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.d.ts +1 -0
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.js +42 -1
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.js.map +1 -1
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.module.scss +4 -0
- package/dist/context/OneUIProvider.d.ts +5 -3
- package/dist/context/OneUIProvider.js +35 -46
- package/dist/context/OneUIProvider.js.map +1 -1
- package/dist/hooks/shims/ObjectWatchShim.js +9 -12
- package/dist/hooks/shims/ObjectWatchShim.js.map +1 -1
- package/dist/hooks/useForm.d.ts +16 -0
- package/dist/hooks/useForm.js +24 -0
- package/dist/hooks/useForm.js.map +1 -0
- package/dist/hooks/useObserve.js +3 -1
- package/dist/hooks/useObserve.js.map +1 -1
- package/dist/hooks/useRebound.d.ts +9 -0
- package/dist/hooks/useRebound.js +24 -0
- package/dist/hooks/useRebound.js.map +1 -0
- package/dist/hooks/useShortIntl.d.ts +1 -0
- package/dist/hooks/useShortIntl.js +5 -2
- package/dist/hooks/useShortIntl.js.map +1 -1
- package/package.json +8 -3
- package/scripts/start-emulator.js +48 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectWatchShim.js","sourceRoot":"","sources":["../../../src/hooks/shims/ObjectWatchShim.ts"],"names":[],"mappings":";AAAA,cAAc;AACd,eAAe;AACf,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK;IACzB,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,UAAU,eAAe,EAAE,OAAO;QACzD,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC/B,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,EACrB,MAAM,GAAG,MAAM,E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ACb,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;YACJ,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE;gBACrB,wBAAwB;gBACxB,IAAI,MAAM,CAAC,cAAc,EAAE;oBACzB,yBAAyB;oBACzB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE;wBAChC,GAAG,EAAE,MAAM;wBACX,GAAG,EAAE,MAAM;qBACZ,CAAC,CAAC;iBACJ;qBACI,IACH,MAAM,CAAC,SAAS,CAAC,gBAAgB;oBACjC,MAAM,CAAC,SAAS,CAAC,gBAAgB,EACjC;oBACA,SAAS;oBACT,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;oBAC3D,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;iBAC5D;aACF;QACH,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseForm, FieldDefinition, FieldTypes } from "../components/Form/Form";
|
|
2
|
+
declare type Intermediary<F extends BaseForm> = {
|
|
3
|
+
form: F;
|
|
4
|
+
formValidation: {
|
|
5
|
+
[k in keyof F]: string;
|
|
6
|
+
} & {
|
|
7
|
+
isValid: string | true;
|
|
8
|
+
};
|
|
9
|
+
set: <K extends keyof F>(k: K, value: F[K]) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare type FormControls<C extends FormConfig<any>> = Intermediary<C extends FormConfig<infer F> ? F : never>;
|
|
12
|
+
export declare type FormConfig<T extends BaseForm> = {
|
|
13
|
+
[k in keyof T]: FieldDefinition<T, k, FieldTypes>;
|
|
14
|
+
};
|
|
15
|
+
export default function useContextForm<T extends BaseForm>(config: FormConfig<T>, initialState: T): FormControls<FormConfig<T>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
function useContextForm(config, initialState) {
|
|
5
|
+
const [form, setForm] = (0, react_1.useState)(initialState);
|
|
6
|
+
const isValid = (0, react_1.useMemo)(() => !Object.keys(config).some((a) => typeof config[a].validator(form[a], form) === "string"), [form]);
|
|
7
|
+
const _setFormField = (key, value) => {
|
|
8
|
+
setForm(prev => (Object.assign(Object.assign({}, prev), { [key]: value })));
|
|
9
|
+
};
|
|
10
|
+
const validFormFields = (0, react_1.useMemo)(() => {
|
|
11
|
+
return Object.keys(config).reduce((result, field) => {
|
|
12
|
+
const fieldConfig = config[field];
|
|
13
|
+
const invalidMessage = fieldConfig.validator(form[field], form);
|
|
14
|
+
return Object.assign(Object.assign({}, result), { [field]: invalidMessage });
|
|
15
|
+
}, { isValid });
|
|
16
|
+
}, [form, isValid]);
|
|
17
|
+
return {
|
|
18
|
+
form: form,
|
|
19
|
+
formValidation: validFormFields,
|
|
20
|
+
set: _setFormField
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.default = useContextForm;
|
|
24
|
+
//# sourceMappingURL=useForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForm.js","sourceRoot":"","sources":["../../src/hooks/useForm.ts"],"names":[],"mappings":";;AAAA,iCAAkD;AAYlD,SAAwB,cAAc,CAClC,MAAqB,EACrB,YAAe;IAEf,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAa,YAAY,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,IAAA,eAAO,EACnB,GAAG,EAAE,CACD,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CACrB,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,QAAQ,CAChE,EACL,CAAC,IAAI,CAAC,CACT,CAAC;IAEF,MAAM,aAAa,GAAmD,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACjF,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,iCACT,IAAI,KACP,CAAC,GAAG,CAAC,EAAE,KAAK,IACd,CAAC,CAAA;IACP,CAAC,CAAA;IAED,MAAM,eAAe,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACjC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAc,EAAE,EAAE;YACzD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAClC,MAAM,cAAc,GAAG,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;YAChE,uCACO,MAAM,KACT,CAAC,KAAK,CAAC,EAAE,cAAc,IAC1B;QACL,CAAC,EAAE,EAAE,OAAO,EAA8D,CAAC,CAAA;IAC/E,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAEpB,OAAO;QACH,IAAI,EAAE,IAAI;QACV,cAAc,EAAE,eAAe;QAC/B,GAAG,EAAE,aAAa;KACd,CAAA;AACZ,CAAC;AApCD,iCAoCC"}
|
package/dist/hooks/useObserve.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useObserve.js","sourceRoot":"","sources":["../../src/hooks/useObserve.ts"],"names":[],"mappings":";;AAAA,iCAA6D;AAC7D,sCAAoC;AAOpC,SAAwB,UAAU,CAChC,MAAS,EACT,aAA0B;IAE1B,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAC5B,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,OAAQ,MAAiB,CAAC,KAAK,CAAC,aAAoB,EAAE,GAAG,EAAE;YACzD,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"useObserve.js","sourceRoot":"","sources":["../../src/hooks/useObserve.ts"],"names":[],"mappings":";;AAAA,iCAA6D;AAC7D,sCAAoC;AAOpC,SAAwB,UAAU,CAChC,MAAS,EACT,aAA0B;IAE1B,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAC5B,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,OAAQ,MAAiB,CAAC,KAAK,CAAC,aAAoB,EAAE,GAAG,EAAE;YACzD,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;gBACP,OAAO,CAAC,GAAG,CAAC,CAAA;YACd,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACf,CAAC;AAZD,6BAYC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* This hook adds a prop that you can toggle and returns to initial
|
|
4
|
+
* state after a defined time (usefull for notification)
|
|
5
|
+
*/
|
|
6
|
+
export default function useRebound<T extends any>(initialValue: T, timeoutSec?: number): {
|
|
7
|
+
current: T;
|
|
8
|
+
setState: import("react").Dispatch<import("react").SetStateAction<T>>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
/**
|
|
5
|
+
* This hook adds a prop that you can toggle and returns to initial
|
|
6
|
+
* state after a defined time (usefull for notification)
|
|
7
|
+
*/
|
|
8
|
+
function useRebound(initialValue, timeoutSec = 1) {
|
|
9
|
+
const [state, setState] = (0, react_1.useState)(initialValue);
|
|
10
|
+
(0, react_1.useEffect)(() => {
|
|
11
|
+
if (state !== initialValue) {
|
|
12
|
+
const timeout = setTimeout(() => {
|
|
13
|
+
setState(initialValue);
|
|
14
|
+
}, timeoutSec * 1000);
|
|
15
|
+
return () => clearTimeout(timeout);
|
|
16
|
+
}
|
|
17
|
+
}, [state]);
|
|
18
|
+
return {
|
|
19
|
+
current: state,
|
|
20
|
+
setState
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.default = useRebound;
|
|
24
|
+
//# sourceMappingURL=useRebound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRebound.js","sourceRoot":"","sources":["../../src/hooks/useRebound.ts"],"names":[],"mappings":";;AAAA,iCAA2C;AAE3C;;;GAGG;AACH,SAAwB,UAAU,CAAgB,YAAe,EAAE,aAAqB,CAAC;IACrF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAI,YAAY,CAAC,CAAA;IAEnD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,IAAI,KAAK,KAAK,YAAY,EAAE;YACxB,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC5B,QAAQ,CAAC,YAAY,CAAC,CAAA;YAC1B,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC;YAEtB,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;SACtC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO;QACH,OAAO,EAAE,KAAK;QACd,QAAQ;KACX,CAAA;AACL,CAAC;AAhBD,6BAgBC"}
|
|
@@ -2,6 +2,7 @@ import { IntlFormatters, IntlShape } from "react-intl";
|
|
|
2
2
|
import { BigNumber } from "bignumber.js";
|
|
3
3
|
export default function useShortIntl(): IntlShape & {
|
|
4
4
|
txt: (id: OnepercentUtility.IntlIds, params?: Parameters<IntlFormatters["formatMessage"]>[1]) => ReturnType<IntlFormatters["formatMessage"]>;
|
|
5
|
+
formatToDoubleDecimal(number: number, options?: Parameters<IntlFormatters["formatNumber"]>[1]): string;
|
|
5
6
|
formatBigNumber(number: BigNumber, options?: Parameters<IntlFormatters["formatNumber"]>[1]): string;
|
|
6
7
|
};
|
|
7
8
|
declare type StrMap = {
|
|
@@ -4,10 +4,13 @@ exports.isolateMessages = void 0;
|
|
|
4
4
|
const react_intl_1 = require("react-intl");
|
|
5
5
|
function useShortIntl() {
|
|
6
6
|
const intl = (0, react_intl_1.useIntl)();
|
|
7
|
-
const { formatMessage } = intl;
|
|
7
|
+
const { formatMessage, formatNumber } = intl;
|
|
8
8
|
return Object.assign(Object.assign({}, intl), { txt: (id, params) => {
|
|
9
9
|
return formatMessage({ id }, params);
|
|
10
|
-
},
|
|
10
|
+
}, formatToDoubleDecimal(val, options = {}) {
|
|
11
|
+
return formatNumber(val, Object.assign({ minimumFractionDigits: 2, maximumFractionDigits: 2 }, options));
|
|
12
|
+
},
|
|
13
|
+
formatBigNumber(bigNumber, options) {
|
|
11
14
|
const { decimalSeparator } = intl
|
|
12
15
|
.formatNumberToParts(1000.1)
|
|
13
16
|
.reduce((r, a) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShortIntl.js","sourceRoot":"","sources":["../../src/hooks/useShortIntl.ts"],"names":[],"mappings":";;;AAAA,2CAAgE;AAGhE,SAAwB,YAAY;
|
|
1
|
+
{"version":3,"file":"useShortIntl.js","sourceRoot":"","sources":["../../src/hooks/useShortIntl.ts"],"names":[],"mappings":";;;AAAA,2CAAgE;AAGhE,SAAwB,YAAY;IAWlC,MAAM,IAAI,GAAG,IAAA,oBAAO,GAAE,CAAC;IACvB,MAAM,EAAE,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AAO,GAAG,OAAO,GAAG,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,gBAAgB,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,EACxE,EAAE,CAAC;QACP,CAAC,IACD;AACJ,CAAC;AAhDD,+BAgDC;AAUD,SAAgB,eAAe,CAC7B,OAAU,EACV,OAAU;IAEV,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CACnC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,iCACV,CAAC,KACJ,CAAC,GAAG,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IACtB,EACF,EAA4C,CAC7C,CAAC;AACJ,CAAC;AAXD,0CAWC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onepercentio/one-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A set of reusable components created through the development of Onepercent projects",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"WebpackConfigs",
|
|
8
8
|
"cypress/support"
|
|
9
9
|
],
|
|
10
|
+
"bin": {
|
|
11
|
+
"start-emulator": "scripts/start-emulator.js"
|
|
12
|
+
},
|
|
10
13
|
"repository": "git@github.com:onepercentio/one-ui.git",
|
|
11
14
|
"author": "Murilo Oliveira de Araujo <muritavo@outlook.com>",
|
|
12
15
|
"license": "MIT",
|
|
@@ -42,6 +45,7 @@
|
|
|
42
45
|
"https-browserify": "^1.0.0",
|
|
43
46
|
"inquirer": "^8.2.4",
|
|
44
47
|
"jest": "^27.3.1",
|
|
48
|
+
"node-fetch": "^2",
|
|
45
49
|
"node-sass": "^6.0.1",
|
|
46
50
|
"os-browserify": "^0.3.0",
|
|
47
51
|
"react": "^18.0.0",
|
|
@@ -54,9 +58,10 @@
|
|
|
54
58
|
"stream-http": "^3.2.0",
|
|
55
59
|
"style-loader": "^2",
|
|
56
60
|
"ts-jest": "^27.0.7",
|
|
61
|
+
"type-fest": "^2.13.1",
|
|
57
62
|
"typescript": "^4.5.2",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
63
|
+
"url": "^0.11.0",
|
|
64
|
+
"use-wallet": "0.13.5"
|
|
60
65
|
},
|
|
61
66
|
"dependencies": {
|
|
62
67
|
"@types/chroma-js": "^2.1.3",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fetch = require("node-fetch");
|
|
4
|
+
const { spawn } = require("child_process");
|
|
5
|
+
function WaitTimeout(ml = 200) {
|
|
6
|
+
return new Promise((r) => {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
r();
|
|
9
|
+
}, ml);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const [, , projectId, databaseToImport] = process.argv;
|
|
13
|
+
|
|
14
|
+
if (!projectId) {
|
|
15
|
+
console.error("You need to provide a project id");
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
spawn(
|
|
19
|
+
`firebase emulators:start -P ${projectId} ${
|
|
20
|
+
databaseToImport ? `--import ${databaseToImport}` : ""
|
|
21
|
+
}`,
|
|
22
|
+
{
|
|
23
|
+
cwd: undefined,
|
|
24
|
+
env: process.env,
|
|
25
|
+
shell: true,
|
|
26
|
+
detached: true,
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
(async function () {
|
|
31
|
+
let breakLoop = false;
|
|
32
|
+
const timeout = setTimeout(() => {
|
|
33
|
+
breakLoop = true;
|
|
34
|
+
console.error("Could not receive ok from firebase emulator");
|
|
35
|
+
clearTimeout(timeout);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}, 60000);
|
|
38
|
+
while (!breakLoop) {
|
|
39
|
+
try {
|
|
40
|
+
await fetch(`http://localhost:4000`);
|
|
41
|
+
console.log("Emulator restarted");
|
|
42
|
+
clearTimeout(timeout);
|
|
43
|
+
process.exit(0);
|
|
44
|
+
} catch (e) {}
|
|
45
|
+
await WaitTimeout(1000);
|
|
46
|
+
}
|
|
47
|
+
await new Promise((r) => {});
|
|
48
|
+
})();
|