@rc-component/form
Advanced tools
| import type { InternalNamePath, WatchCallBack } from '../interface'; | ||
| import type { FormStore } from './useForm'; | ||
| /** | ||
| * Call action with delay in macro task. | ||
| */ | ||
| export declare const macroTask: (fn: VoidFunction) => void; | ||
| export default class WatcherCenter { | ||
@@ -4,0 +8,0 @@ namePathList: InternalNamePath[]; |
@@ -5,3 +5,3 @@ import { matchNamePath } from "../utils/valueUtil"; | ||
| */ | ||
| const macroTask = fn => { | ||
| export const macroTask = fn => { | ||
| const channel = new MessageChannel(); | ||
@@ -8,0 +8,0 @@ channel.port1.onmessage = fn; |
@@ -0,8 +1,11 @@ | ||
| import { macroTask } from "../hooks/useNotifyWatch"; | ||
| import raf from "@rc-component/util/es/raf"; | ||
| export default async function delayFrame() { | ||
| return new Promise(resolve => { | ||
| raf(() => { | ||
| resolve(); | ||
| macroTask(() => { | ||
| raf(() => { | ||
| resolve(); | ||
| }); | ||
| }); | ||
| }); | ||
| } |
| import type { InternalNamePath, WatchCallBack } from '../interface'; | ||
| import type { FormStore } from './useForm'; | ||
| /** | ||
| * Call action with delay in macro task. | ||
| */ | ||
| export declare const macroTask: (fn: VoidFunction) => void; | ||
| export default class WatcherCenter { | ||
@@ -4,0 +8,0 @@ namePathList: InternalNamePath[]; |
@@ -6,3 +6,3 @@ "use strict"; | ||
| }); | ||
| exports.default = void 0; | ||
| exports.macroTask = exports.default = void 0; | ||
| var _valueUtil = require("../utils/valueUtil"); | ||
@@ -17,2 +17,3 @@ /** | ||
| }; | ||
| exports.macroTask = macroTask; | ||
| class WatcherCenter { | ||
@@ -19,0 +20,0 @@ namePathList = []; |
@@ -7,2 +7,3 @@ "use strict"; | ||
| exports.default = delayFrame; | ||
| var _useNotifyWatch = require("../hooks/useNotifyWatch"); | ||
| var _raf = _interopRequireDefault(require("@rc-component/util/lib/raf")); | ||
@@ -12,6 +13,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| return new Promise(resolve => { | ||
| (0, _raf.default)(() => { | ||
| resolve(); | ||
| (0, _useNotifyWatch.macroTask)(() => { | ||
| (0, _raf.default)(() => { | ||
| resolve(); | ||
| }); | ||
| }); | ||
| }); | ||
| } |
+1
-1
| { | ||
| "name": "@rc-component/form", | ||
| "version": "1.7.1", | ||
| "version": "1.7.2", | ||
| "description": "React Form Component", | ||
@@ -5,0 +5,0 @@ "typings": "es/index.d.ts", |
251340
0.19%6502
0.23%