mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-05 13:59:56 +08:00
feat: Create wait helper function.
This commit is contained in:
parent
3243383fbd
commit
42c09f467b
1
.pnp.cjs
generated
1
.pnp.cjs
generated
@ -5654,6 +5654,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@lowdefy/engine", "workspace:packages/engine"],
|
||||
["@lowdefy/helpers", "workspace:packages/utils/helpers"],
|
||||
["@lowdefy/layout", "workspace:packages/layout"],
|
||||
["@lowdefy/node-utils", "workspace:packages/utils/node-utils"],
|
||||
["@lowdefy/operators-js", "workspace:packages/plugins/operators/operators-js"],
|
||||
["@next/eslint-plugin-next", "npm:12.0.4"],
|
||||
["less", "npm:4.1.2"],
|
||||
|
@ -14,9 +14,7 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const wait = (ms) => {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
};
|
||||
import { wait } from '@lowdefy/helpers';
|
||||
|
||||
async function asyncFn() {
|
||||
await wait(20);
|
||||
|
@ -16,11 +16,7 @@
|
||||
|
||||
import BatchChanges from './BatchChanges.js';
|
||||
|
||||
async function wait(ms) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
import { wait } from '@lowdefy/helpers';
|
||||
|
||||
const context = {};
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import { wait } from '@lowdefy/helpers';
|
||||
|
||||
import errorHandler from './errorHandler.js';
|
||||
import runCommand from './runCommand.js';
|
||||
@ -21,12 +22,6 @@ import startUp from './startUp.js';
|
||||
jest.mock('./errorHandler');
|
||||
jest.mock('./startUp');
|
||||
|
||||
async function wait(ms) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
errorHandler.mockReset();
|
||||
});
|
||||
|
@ -14,13 +14,13 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { type } from '@lowdefy/helpers';
|
||||
import { type, wait } from '@lowdefy/helpers';
|
||||
|
||||
async function Wait({ params }) {
|
||||
if (!type.isInt(params.ms)) {
|
||||
throw new Error(`Wait action "ms" param should be an integer.`);
|
||||
}
|
||||
return new Promise((resolve) => setTimeout(resolve, params.ms));
|
||||
return wait(params.ms);
|
||||
}
|
||||
|
||||
export default Wait;
|
||||
|
@ -14,6 +14,7 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { wait } from '@lowdefy/helpers';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { GoogleSpreadsheet } from 'google-spreadsheet';
|
||||
import getSheet from './getSheet';
|
||||
@ -42,12 +43,6 @@ jest.mock('google-spreadsheet', () => {
|
||||
};
|
||||
});
|
||||
|
||||
async function wait(ms) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
const useApiKeyDefaultImp = (apiKey) => {
|
||||
if (apiKey !== 'valid') {
|
||||
throw new Error('Test Api Key Auth Error.');
|
||||
|
@ -15,12 +15,12 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { wait } from '@lowdefy/helpers';
|
||||
import opener from 'opener';
|
||||
import getContext from './getContext.mjs';
|
||||
import initialBuild from './initialBuild.mjs';
|
||||
import startServer from './processes/startServer.mjs';
|
||||
import startWatchers from './watchers/startWatchers.mjs';
|
||||
import wait from './wait.mjs';
|
||||
|
||||
async function run() {
|
||||
const context = await getContext();
|
||||
|
@ -26,6 +26,7 @@ import swap from './swap.js';
|
||||
import type from './type.js';
|
||||
import unset from './unset.js';
|
||||
import urlQuery from './urlQuery.js';
|
||||
import wait from './wait.js';
|
||||
|
||||
export {
|
||||
applyArrayIndices,
|
||||
@ -40,4 +41,5 @@ export {
|
||||
type,
|
||||
unset,
|
||||
urlQuery,
|
||||
wait,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user