Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 521 Bytes

File metadata and controls

27 lines (21 loc) · 521 Bytes

data

callback管理工具

Usage


import CallbackProvider from '@geeeger/callback-provider';

describe('test', () => {
    test('should pass', () => {
        const c = new CallbackProvider(window);
        function d() {
            return new Promise((res) => {
                c.pushCallbackStack('x', (data) => {
                    res(data);
                });
                c.listen('x');
            });
        }

        expect(d()).resolves.toEqual(1);
        c.run('x', 1);
    });
});