本文整理汇总了TypeScript中rxjs.ReplaySubject.next方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ReplaySubject.next方法的具体用法?TypeScript ReplaySubject.next怎么用?TypeScript ReplaySubject.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rxjs.ReplaySubject
的用法示例。
在下文中一共展示了ReplaySubject.next方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should not react when unregistered action dispatched.', fakeAsync(() => {
const callback = jasmine.createSpy('callback');
const subscription = effects.detectChanges.subscribe(callback);
const fileChanges = createDummies(fileChangeDummy, 10);
(vcsService.fetchFileChanges as Spy).and.returnValue(of(fileChanges));
actions.next(testActions.unregisteredAction);
tick(VCS_DETECT_CHANGES_THROTTLE_TIME);
expect(callback).not.toHaveBeenCalledWith(new UpdateFileChangesAction({ fileChanges }));
subscription.unsubscribe();
}));
示例2:
(data) => {
components.next(data.children.reduce((accum, child) => {
if (child.name.match(regexComponent) && child.children) {
for (const grandchild of child.children) {
if (!!grandchild.decorators &&
(grandchild.decorators[0].name === 'Component' ||
grandchild.decorators[0].name === 'Directive')) {
accum.push(grandchild);
}
}
}
return accum;
}, []));
},
示例3: getNpmConfigOption
function getNpmConfigOption(
option: string,
scope?: string,
tryWithoutScope?: boolean,
): Observable<string | undefined> {
if (scope && tryWithoutScope) {
return concat(
getNpmConfigOption(option, scope),
getNpmConfigOption(option),
).pipe(
filter(result => !!result),
defaultIfEmpty(),
first(),
);
}
const fullOption = `${scope ? scope + ':' : ''}${option}`;
let value = npmConfigOptionCache.get(fullOption);
if (value) {
return value;
}
const subject = new ReplaySubject<string | undefined>(1);
try {
exec(`npm get ${fullOption}`, (error, data) => {
if (error) {
subject.next();
} else {
data = data.trim();
if (!data || data === 'undefined' || data === 'null') {
subject.next();
} else {
subject.next(data);
}
}
subject.complete();
});
} catch {
subject.next();
subject.complete();
}
value = subject.asObservable();
npmConfigOptionCache.set(fullOption, value);
return value;
}
示例4: _updateWithDirection
// *********************************************
// Protected methods
// *********************************************
/** Validate the direction value and then update the host's inline flexbox styles */
protected _updateWithDirection(value?: string) {
value = value || this._queryInput('layout') || 'row';
if (this._mqActivation) {
value = this._mqActivation.activatedInput;
}
// Update styles and announce to subscribers the *new* direction
let css = buildLayoutCSS(!!value ? value : '');
this._applyStyleToElement(css);
this._announcer.next({
direction: css['flex-direction'],
wrap: !!css['flex-wrap'] && css['flex-wrap'] !== 'nowrap'
});
}
示例5: fakeAsync
+ 'with the note content, when success.', fakeAsync(() => {
(noteEditor.loadNoteContent as jasmine.Spy).and.returnValue(of(content));
const callback = jasmine.createSpy('load callback');
const subscription = contentEffects.load.subscribe(callback);
actions.next(new LoadNoteContentAction({ note: noteItem }));
tick(NOTE_EDITOR_LOAD_NOTE_CONTENT_THROTTLE);
expect(callback).toHaveBeenCalledWith(new LoadNoteContentCompleteAction({
note: noteItem,
content,
}));
subscription.unsubscribe();
}));
示例6: beforeEach
beforeEach(() => {
const httpStateServiceStub = { httpAction: httpAction };
httpAction.next({});
TestBed.configureTestingModule({
schemas: [NO_ERRORS_SCHEMA],
imports: [
TranslateModule.forRoot({ loader: { provide: TranslateLoader, useClass: TranslateFakeLoader } })
],
declarations: [SaveButtonComponent],
providers: [
{ provide: HttpStateService, useValue: httpStateServiceStub }
]
});
fixture = TestBed.createComponent(SaveButtonComponent);
component = fixture.componentInstance;
});
示例7: if
(data) => {
if (data.children) {
data.children = data.children.filter((child) => {
if (!!child.decorators &&
(child.decorators[0].name === 'Input' ||
child.decorators[0].name === 'Output')) {
return child;
}
});
data.children = data.children.sort((prev, next) => {
if (prev.decorators[0].name === 'Input' && next.decorators[0].name === 'Output') {
return -1;
} else if (prev.decorators[0].name === 'Output' && next.decorators[0].name === 'Input') {
return 1;
} else {
return (prev.name).localeCompare(next.name);
}
});
properties.next(
data.children
);
}
},