3
當我一直在尋找通過我碰到這個功能跌跌撞撞rxjs庫:打字稿爲參
export function map<T, R>(this: Observable<T>, project: (value: T, index: number) => R, thisArg?: any): Observable<R> {
if (typeof project !== 'function') {
throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
}
return this.lift(new MapOperator(project, thisArg));
}
來源:https://github.com/ReactiveX/rxjs/blob/master/src/operator/map.ts
我在想傳遞一個名爲this
參數時到底發生了什麼。 它只是像對待任何其他參數一樣對待,或者當你這樣做時打印一些特別的動作?