本文整理匯總了TypeScript中rxjs/operators.ignoreElements函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript ignoreElements函數的具體用法?TypeScript ignoreElements怎麽用?TypeScript ignoreElements使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ignoreElements函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: observableDefer
return observableDefer(() => {
if (shouldUnsetMediaKeys()) {
return disposeMediaKeys(mediaElement, attachedMediaKeysInfos)
.pipe(ignoreElements());
}
const currentState = attachedMediaKeysInfos.getState(mediaElement);
if (currentState && currentState.keySystemOptions.closeSessionsOnStop) {
return currentState.sessionsStore.closeAllSessions()
.pipe(ignoreElements());
}
return EMPTY;
});
示例2: mergeMap
mergeMap((sessionInfosEvt) => {
if (sessionInfosEvt.type === "warning") {
return observableOf(sessionInfosEvt);
}
const {
initData,
initDataType,
mediaKeySession,
sessionType,
keySystemOptions,
sessionStorage,
} = sessionInfosEvt.value;
return observableMerge(
handleSessionEvents(mediaKeySession, keySystemOptions),
// only perform generate request on new sessions
sessionInfosEvt.type === "created-session" ?
generateKeyRequest(mediaKeySession, initData, initDataType).pipe(
tap(() => {
if (sessionType === "persistent-license" && sessionStorage != null) {
sessionStorage.add(initData, initDataType, mediaKeySession);
}
}),
catchError((error: Error) => {
throw new EncryptedMediaError(
"KEY_GENERATE_REQUEST_ERROR", error.toString(), false);
}),
ignoreElements()
) : EMPTY
).pipe(filter((sessionEvent) : sessionEvent is IEMEWarningEvent =>
sessionEvent.type === "warning"
));
})
示例3: concatMap
concatMap(normalized => {
return from([normalized.replace, normalized.with]).pipe(
mergeMap(path => host.exists(path).pipe(errorOnFalse(path))),
ignoreElements(),
concat(of(normalized)),
);
}),
示例4: observableConcat
).pipe(mergeMap(() => {
const cleaningOldSessions$ : Array<Observable<unknown>> = [];
const entries = sessionsStore.getAll().slice();
if (MAX_SESSIONS > 0 && MAX_SESSIONS <= entries.length) {
for (let i = 0; i < (MAX_SESSIONS - entries.length + 1); i++) {
cleaningOldSessions$.push(
sessionsStore.deleteAndCloseSession(entries[i].session)
);
}
}
return observableConcat(
observableMerge(...cleaningOldSessions$).pipe(ignoreElements()),
createSession(initData, initDataType, mediaKeysInfos)
.pipe(map((evt) => ({
type: evt.type,
value: {
mediaKeySession: evt.value.mediaKeySession,
sessionType: evt.value.sessionType,
initData,
initDataType,
},
})))
);
}));
示例5: mergeMap
mergeMap(isDirectory => {
if (isDirectory) {
const allFiles: Path[] = [];
const allDirs: Path[] = [];
const _recurseList = (path: Path) => {
for (const fragment of fs.readdirSync(getSystemPath(path))) {
if (fs.statSync(getSystemPath(join(path, fragment))).isDirectory()) {
_recurseList(join(path, fragment));
allDirs.push(join(path, fragment));
} else {
allFiles.push(join(path, fragment));
}
}
};
_recurseList(path);
return concat(
observableFrom(allFiles).pipe(
mergeMap(p => _callFs(fs.unlink, getSystemPath(p))),
ignoreElements(),
),
observableFrom(allDirs).pipe(
concatMap(p => _callFs(fs.rmdir, getSystemPath(p))),
map(() => {}),
),
);
} else {
return _callFs(fs.unlink, getSystemPath(path));
}
}),
示例6: asDiagram
asDiagram('ignoreElements')('should ignore all the elements of the source', () => {
const source = hot('--a--b--c--d--|');
const subs = '^ !';
const expected = '--------------|';
expectObservable(source.pipe(ignoreElements())).toBe(expected);
expectSubscriptions(source.subscriptions).toBe(subs);
});
示例7: it
it('should support Observable.throw', () => {
const source = cold('#');
const subs = '(^!)';
const expected = '#';
expectObservable(source.pipe(ignoreElements())).toBe(expected);
expectSubscriptions(source.subscriptions).toBe(subs);
});
示例8: observableDefer
return observableDefer(() => {
const previousEntries = this._entries;
this._entries = []; // clean completely the cache first
const disposed = previousEntries
.map((entry) => this.deleteAndCloseSession(entry.session));
return observableConcat(
observableMerge(...disposed).pipe(ignoreElements()),
observableOf(null)
);
});
示例9: omit
useEpic((actor$) => {
return actor$.pipe(
rxFilter(RequestActor.isRequestActor),
rxScan(
(counts, actor: any) => {
const parentActorType = actor.opts.parentActor.type;
const count = counts[parentActorType] || 0;
if (actor.stage === AsyncStage.STARTED) {
return {
...counts,
[parentActorType]: count + 1,
};
}
if (count > 1) {
return {
...counts,
[parentActorType]: count - 1,
};
}
return omit(counts, parentActorType);
},
{} as Dictionary<number>,
),
rxTap((nextRequests) => {
requesting$.next(size(nextRequests) > 0);
}),
rxIgnoreElements(),
);
});