ค้นหาเว็บไซต์
ฉันกำลังพยายามกรองเหตุการณ์ท้องถิ่นใน React Native ด้วย RxJS ฉันกำลังใช้ react-native-ble-manager ซึ่งเปิดเผย EventEmitter โดยพื้นฐานแล้ว โดยไม่ใช้ RxJS ฉันกำลังทำสิ่งต่อไปนี้ (แสดงเฉพาะโค้ดที่เกี่ยวข้องเท่านั้น):
import React from 'react'; import RX from 'reactxp'; import { AppState, Platform, NativeModules, NativeEventEmitter, EmitterSubscription, PermissionsAndroid, ListView } from 'react-native'; import BleManager, { Peripheral } from 'react-native-ble-manag อ่านต่อไป →
นี่คือตัวอย่างโค้ดที่สมัครสมาชิกกับคำขอ Http และยกเลิกเมื่อคลิกเมาส์บนหน้าเว็บ ฉันต้องการสมัครสมาชิกใหม่หากฉันคลิกอีกครั้ง
ฉันสามารถสลับการสมัครสมาชิกได้อย่างไร? FIDDLE
export class AboutComponent implements OnInit { constructor(private http:HttpClient){ } flag=true; documentclick อ่านต่อไป →
ฉันมีเมธอด run ในคลาส Some ที่ส่งค่ากลับเป็น Observable และมี pipe อยู่ภายในเมธอดนี้ และฉันก็มี pipe อีกหนึ่งตัวเมื่อเรียกใช้เมธอด run
import { of } from 'rxjs'; import { map, tap, delay } from 'rxjs/operators'; class Some { r อ่านต่อไป →
ฉันมีโค้ดชิ้นต่อไปนี้ สิ่งที่ฉันพยายามทำคือการเปลี่ยนเส้นทางไปยังหน้าที่ไม่พบเมื่อฟังก์ชัน "find" ไม่พบวัตถุคำสั่งใด ๆ ในคำสั่งที่โหลดใน observable
private order: Observable<OrderModel>; ngOnInit() { this.route.params.subscribe(params = อ่านต่อไป →ฉันต้องการตั้งค่า nameMatch เป็น nodeName หาก nodeName ปรากฏในสตรีมที่สามารถสังเกตได้ เช่นเดียวกันกับ idMatch ฉันกำลังพยายามใช้ตัวดำเนินการ find ของ rxjs นี่คือสิ่งที่ฉันมีอยู่ในตอนนี้:
const response = (this._resourceService.search(ResourceUrns.SERVICE_METRIC) .pipe( map(getServiceNodes)) .subscribe(result => { if (result.find(nodeName)){ อ่านต่อไป →Rxjs timeout() ใช้งานไม่ถูกต้องสำหรับบาง วัน หรือ เวลา
import { interval } from 'rxjs'; import { timeout } from 'rxjs/operators'; const seconds = interval(1000); seconds.pipe( // Present Date (Thu Mar 19 2020 14:40:58) => 1584628858530 // to UTC time & date: (Wed Dec 30 2020 18:30:00) => 1609353000000-------Not working // to UTC time & date: (Mon Dec 30 2030 18:30:00) => 1924885800000-------Working timeout(new Date(160 อ่านต่อไป →ฉันกำลังพยายามแปลงการเชนของพรอมิส:
this.tradeTypesLogicService.getList().$promise .then(this.filterTradeTypes) .then(this.setSelectedTradeType)ไปยัง observable ของ rxjs:
this.tradeTypesLogicService .getList() //returns observable now .pipe(mergeMap(this.filterTradeTypes), map(this.setSelectedTradeType)) .subscribe(); protected filterTradeTypes = (tradeTypes: Array<any>) => { this.tradeTypes = filter(tradeTypes, ( อ่านต่อไป →
กรณีการใช้งาน: เรียกใช้งาน endpoint ทุก 3 นาที ซึ่งจะอัปเดตสถานะของบริการบางอย่างในแอปพลิเคชัน
โค้ดปัจจุบันของฉัน:
interval(180000) .subscribe(() => this.doRequest .pipe(catchError(() => {
อ่านต่อไป →
ฉันต้องการรันบางส่วนของตรรกะของฉันหลังจากการสมัครสมาชิกของฉันพร้อมกับความล่าช้าเพิ่มเติม (ด้วย RxJS) ฉันรู้จักตัวดำเนินการ finalize ซึ่งฉันสามารถใช้กับ pipe ได้ แต่สิ่งนั้นจะทำให้เกิดการดำเนินการทันทีหลังจาก observable ของฉันเสร็จสมบูรณ์
มีวิธีใดท
อ่านต่อไป →
แอปพลิเคชันเอกสาร Angular Material ดึงพารามิเตอร์ของเส้นทางจากโมดูลเส้นทางที่โหลดแบบ lazy ได้ดังนี้:
https://github.com/angular/material.angular.io/blob/master/src/app/pages/component-category-list/component-category-list.ts
// Combine params from all of the path into อ่านต่อไป →