本文整理匯總了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));
}
}