本文整理汇总了TypeScript中flux.Dispatcher.dispatch方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Dispatcher.dispatch方法的具体用法?TypeScript Dispatcher.dispatch怎么用?TypeScript Dispatcher.dispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flux.Dispatcher
的用法示例。
在下文中一共展示了Dispatcher.dispatch方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(dispatcher:Dispatcher<GigaAction>, props:GigaProps) {
super(dispatcher);
this.props = props;
dispatcher.dispatch({
type: GigaActionType.INITIALIZE
});
}
示例2: search
static search(query: IssueQuery) {
const keyword = query.keyword;
const checked = !query.filterByChecked;
dispatcher.dispatch(
{
type: 'issue/query',
query
}
);
return WebApi.query<Issue>('issues', {
keyword,
checked
})
.then(result => {
dispatcher.dispatch(
{
type: 'issue/getIssues',
issues: result.result
}
);
return result.result;
})
}
示例3: it
it("can handle CLEAR_SORT action", ()=> {
// start with a gender sort
const firstSort:SortUpdateAction = {
type: GigaActionType.NEW_SORT,
sortBys: [sortByGender]
};
dispatcher.dispatch(firstSort);
// simulate clear sort
const action:ClearSortAction = {
type: GigaActionType.CLEAR_SORT
};
dispatcher.dispatch(action);
expect(store.getState().sortBys.length).toBe(0);
});
示例4:
.then(updated => {
dispatcher.dispatch(
{
type: 'issue/update',
issue: updated
}
);
return updated;
});
示例5: switchFilterByChecked
static switchFilterByChecked(filterByChecked: boolean) {
dispatcher.dispatch(
{
type: 'issue/query',
query: {
filterByChecked
}
}
);
}
示例6: changeFilterKeyword
static changeFilterKeyword(keyword: string) {
dispatcher.dispatch(
{
type: 'issue/query',
query: {
keyword
}
}
);
}