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