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