Asynchronous events and $this

Given the following code that with the (anonymou)s callback function supplied in .then() and the requirement to only work with the “places” from storage there is no way to determine how long this (somehow expensive) read from local storage will take.

This is a somewhat contrived example but should explain the underlying concern.


export class MyPage {

  //class variables

    //other init objects
    ) {


  } //end of the constructor

  //other (mandatory) methods

  private reloadMap() {
    //Getting the array of user-owned places from storage
    let that = this;
    this.asyncLocalStorage.getItem("places").then(function (value) {
      that.places = JSON.parse(value);

    //do something with the new values