本文整理汇总了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(),
);
});