Open Bug 1695642 Opened 4 years ago Updated 4 years ago

Cant access this context after promise return

Categories

(DevTools :: Debugger, defect)

defect

Tracking

(Not tracked)

People

(Reporter: Honza, Unassigned, NeedInfo)

Details

Originally reported here: https://github.com/firefox-devtools/debugger/issues/8297

Hi,
I would like to know why i cant see on the debugger the context 'this' object. It is as undefined on firefox debugger, but it appears on chrome debugger.

The code of my ts file is:

export class MYClass {
refresData(): void {
this.myService.getFunction(1)
      .then(result => {
        this.myProperty = result; // This object appears as undefined
 }
}
}

The code of service:

async getFunction(id: number): Promise<MyObject> {
    return of({...}).toPromise();
  }

Version 82.0.2 (64-bit) on Windows 10

@Bomsy, can you please try to reproduce this bug, thank you!

Honza

Flags: needinfo?(hmanilla)
You need to log in before you can comment on or make changes to this bug.