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