0

I am new to es6 and thought of implementing arrow functions in a legacy system.

I have written a generic function to execute every ajax call. Below is the code I am using. It is not getting executed in iOS9.

    var Promise = httpCall(apiUrl,requestMap,"json",true);
    Promise.success(data => {callback(data);});
    Promise.error(data => {console.log("SequenceId:error:"+data.responseText);});
    function httpCall(apiUrl, data, dataType, async) {
        return $.ajax({
            url: apiUrl,
            dataType: dataType,
            data: data,
            async: async
        })
    }

I have also found that arrow functions are not supported in iOS 9 from the below link. http://kangax.github.io/compat-table/es6/

But I just want to understand if there is any work around to solve this issue.

  • 2
    Since you're not using lexicon `this` you can just use ordinary functions instead. If you really want arrow functions you can use Babel – Paul Nov 07 '16 at 07:18
  • 2
    [CanIUse =>](http://caniuse.com/#search=%3D%3E) – Rajesh Nov 07 '16 at 07:18

0 Answers0