延迟wait
毫秒后执行处理器callback
https://github.com/ddzy/ts-utility-plugins/tree/master/src/ddzy/utility/function/delay
delay.test.tsimport { delay } from "../../utility/function/delay";describe('delay', () => {test('delay should fire the callback after wait ms', () => {const received = function () {expect(true).toBeTruthy();}delay(received, 500);});test('delay should receive params that passed', () => {const received = function (name: string, age: number) {expect(name).toBe('ddzy');expect(age).toBe(21);}delay(received, 1000, 'ddzy', 21);});test('delay should return the timeout id', () => {const received = function () {expect(true).toBeTruthy();}const result = delay(received, 1500);expect(typeof result).toBe('number');});});