本文整理匯總了TypeScript中rxjs.Subscriber類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Subscriber類的具體用法?TypeScript Subscriber怎麽用?TypeScript Subscriber使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Subscriber類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: catch
return new Observable<any>((subscriber: Subscriber<any>) => {
try {
subscriber.error(this.transform(error));
} catch (err) {
subscriber.error(error);
}
});
示例2:
adapter.open(openOptions, (error) => {
if (error) {
obs.error(error);
return;
}
obs.next(adapter);
obs.complete();
});
示例3: DisconnectError
adapter.disconnect(device.instanceId, (err) => {
if (err) {
obs.error(new DisconnectError(err, device));
return;
}
obs.next();
obs.complete();
});
示例4: ReadCharacteristicError
adapter.readCharacteristicValue(characteristic.instanceId, (err, value) => {
if (err) {
obs.error(new ReadCharacteristicError(err, characteristic));
return;
}
obs.next(toHexString(value));
obs.complete();
});
示例5: CharacteristicDiscoveryError
adapter.getCharacteristics(service.instanceId, (err, chars) => {
if (err) {
obs.error(new CharacteristicDiscoveryError(err, service));
return;
}
obs.next(chars);
obs.complete();
});
示例6: ServiceDiscoveryError
adapter.getServices(device.instanceId, (err, services) => {
if (err) {
obs.error(new ServiceDiscoveryError(err, device));
return;
}
obs.next(services);
obs.complete();
});
示例7:
this.import(data, (d, e) => {
if (e) {
sub.error(e);
} else {
sub.next(d);
sub.complete();
}
});
示例8:
request(url, params, (err: Error, response: IncomingMessage, body: any) => {
if (err) {
return subscriber.error(err);
}
Request.recentResponse = response;
subscriber.next(body);
subscriber.complete();
});