跳至主要內容

setImmediate

小于 1 分钟featureweb-standard

setImmediate

模块

类型

function setImmediate<A extends Array<any>>(
  callback: (...args: A) => void,
  ...args: A
): number;
function clearImmediate(id: number): void;

入口点

core-js(-pure)/stable|actual|full/set-immediate
core-js(-pure)/stable|actual|full/clear-immediate

示例

示例open in new window:

setImmediate(
  (arg1, arg2) => {
    console.log(arg1, arg2); // => 消息会被尽快显示
  },
  "Message will be displayed",
  "with minimum delay"
);

clearImmediate(
  setImmediate(() => {
    console.log("Message will not be displayed");
  })
);