Details

    • Story Points:
      8

      Description

      We added support for ES6 and later in the latest 7.1.0 changes, which is awesome! The only thing missing is the support for using async/await in Titanium code.

      Here is an example (taken from my sample-project):

        someOtherMethod() {
          this._getUserLocation();
        }
       
        async _getUserLocation() {
          // FIXME: Current throws, work in progress!
          const coordinates = await Ti.Geolocation.getCurrentPosition(event => {
            return new Promise(resolve => {
              resolve(event.coords);
            });
          });
          alert(`Found location! Latitude: ${coordinates.latitude}, Longitude: ${coordinates.longitude}`);
        }
      

      The full sample can be found here. It is throwing an "Cannot find regeneratorRuntime" error when calling the method, which looks like a Babel error that occurs when certain transform-plugins are missing.

      We use the babel-preset-env, which should already support it by having a dependency on babel-plugin-transform-async-to-generator but for some reasons it does not work.

      Important to say is also that I may be doing something wrong, so let me know if thats the case!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gmathews Gary Mathews
                Reporter:
                hknoechel Hans Knöchel
                Reviewer:
                Christopher Williams
              • Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code