本文整理汇总了TypeScript中redux-saga/effects.call函数的典型用法代码示例。如果您正苦于以下问题:TypeScript call函数的具体用法?TypeScript call怎么用?TypeScript call使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了call函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: call
const promises = repositories.map(repo => call(fetchConfigs, repo.uri));
示例2: fetchPosts
function* fetchPosts() {
yield put( {type: 'REQUEST_POSTS'} )
const posts = yield call(fetchApi, '/posts')
yield put( {type: 'RECEIVE_POSTS', posts} )
}
示例3: testCall
function* testCall(): SagaIterator {
// typings:expect-error
yield call();
// typings:expect-error
yield call({});
yield call(() => {});
// typings:expect-error
yield call((a: 'a') => {});
// typings:expect-error
yield call((a: 'a') => {}, 1);
yield call((a: 'a') => {}, 'a');
// typings:expect-error
yield call((a: 'a', b: 'b') => {}, 'a');
// typings:expect-error
yield call((a: 'a', b: 'b') => {}, 'a', 1);
// typings:expect-error
yield call((a: 'a', b: 'b') => {}, 1, 'b');
yield call((a: 'a', b: 'b') => {}, 'a', 'b');
// typings:expect-error
yield call(
(a: 'a', b: 'b', c: 'c', d: 'd', e: 'e', f: 'f', g: 'g') => {},
1, 'b', 'c', 'd', 'e', 'f', 'g'
);
yield call(
(a: 'a', b: 'b', c: 'c', d: 'd', e: 'e', f: 'f', g: 'g') => {},
'a', 'b', 'c', 'd', 'e', 'f', 'g'
);
const obj = {
foo: 'bar',
getFoo(arg: string) {
return this.foo;
},
};
// typings:expect-error
yield call([obj, obj.foo]);
// typings:expect-error
yield call([obj, obj.getFoo]);
yield call([obj, obj.getFoo], 'bar');
// typings:expect-error
yield call([obj, obj.getFoo], 1);
// typings:expect-error
yield call([obj, 'foo']);
// typings:expect-error
yield call([obj, 'getFoo']);
yield call([obj, 'getFoo'], 'bar');
// typings:expect-error
yield call([obj, 'getFoo'], 1);
// typings:expect-error
yield call({context: obj, fn: obj.foo});
// typings:expect-error
yield call({context: obj, fn: obj.getFoo});
yield call({context: obj, fn: obj.getFoo}, 'bar');
// typings:expect-error
yield call({context: obj, fn: obj.getFoo}, 1);
// typings:expect-error
yield call({context: obj, fn: 'foo'});
// typings:expect-error
yield call({context: obj, fn: 'getFoo'});
yield call({context: obj, fn: 'getFoo'}, 'bar');
// typings:expect-error
yield call({context: obj, fn: 'getFoo'}, 1);
}
示例4: showPostDeal
function* showPostDeal(action: any): any {
// 衳轏
yield call((path: string): any => history.push(path), '/wiki/wikipost/' + action.payload.postId);
}
示例5: fetchProducts
function* fetchProducts() {
yield put( {type: 'REQUEST_PRODUCTS'} )
const products = yield call(fetchApi, '/products')
yield put( {type: 'RECEIVE_PRODUCTS', products } )
}
示例6: updateProxy
function* updateProxy(window: SEnvWindowInterface, isNew: boolean) {
const containsProxy = proxies.has(window.$id);
let proxy: SEnvWindowInterface;
let disposeMirror: () => any;
if (!containsProxy) {
proxy = window.clone();
const position = window.screenLeft || window.screenTop ? { left: window.screenLeft, top: window.screenTop } : (yield call(getBestWindowPosition, window.browserId, (existingWindow: SyntheticWindow) => existingWindow.$id !== window.$id));
proxy.moveTo(position.left, position.top);
proxy.resizeTo(window.innerWidth, window.innerHeight);
proxy.renderer = createRenderer(proxy);
proxy.renderer.start();
disposeMirror = () => {};
yield put(syntheticWindowProxyOpened(proxy, undefined, isNew));
} else {
[proxy, disposeMirror] = proxies.get(window.$id);
}
disposeMirror();
proxies.set(window.$id, [proxy, mirrorWindow(proxy, window)])
};
示例7: handleInitCmd
function* handleInitCmd(action: Action<string>) {
const repoUri = action.payload as string;
yield call(requestRepoInitCmd, repoUri);
}
示例8: call
querySaga: function* () {
yield call(delay, 0);
yield call(() => queryCounterCalled++);
},
示例9: handleNextWindowPressed
function* handleNextWindowPressed() {
while(true) {
yield take(NEXT_ARTBOARD_SHORTCUT_PRESSED);
yield call(shiftSelectedArtboard, 1);
}
}
示例10: rootSaga
export default function* rootSaga() {
while (true) {
const tickAction = yield call(awaitTick, 15 * 1000);
yield(put(tickAction));
}
}