本文整理匯總了TypeScript中state/reduxStore.dispatch函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript dispatch函數的具體用法?TypeScript dispatch怎麽用?TypeScript dispatch使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了dispatch函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('sends params', () => {
const sticky = {x: 999, y: 123, body: 'foo', uuid: 'uuid val'}
dispatch(createStickyAction(sticky))
dispatch(interactionFinishedStickyAction({uuid: 'uuid val'}))
return waitForPromises().then(() => {
expect(jsonRequestStub.lastCall.args[0].body).to.eql(combine(sticky, {url_token}))
})
})
示例2: it
it('calls service with createStickyAction', () => {
const stub = sinon.stub().returns(Promise.resolve())
injectMock(() => sendActionToServer, () => stub as any)
dispatch(createStickyAction({x: 1, y: 2, body: 'some sticky', uuid: 'some uuid'}))
expect(stub.firstCall.args[0].payload).to.eql({x: 1, y: 2, body: 'some sticky', uuid: 'some uuid'})
expect(stub.firstCall.args[0].type).to.eql('CREATE_STICKY')
})
示例3: expect
.then(() => {
expect(getState().persistenceQueue.count()).to.eql(1)
stub.returns(Promise.resolve())
dispatch(createStickyAction({x: 1, y: 2, body: 'some other sticky', uuid: 'some uuid'}))
expect(getState().persistenceQueue.count()).to.eql(2)
stub.reset()
stub.returns(Promise.resolve())
})
示例4: dispatch
.then(() => {
dispatch(persistenceQueueSuccessAction({queueUuid: item.queueUuid}))
persist()
})