error syntax when using then ((result) =

0

I have a site that uses the payment.me (payment getaway) I created a webview that runs perfectly on android versions 7 and 8, but in versions 6, 5 and 4 the webview presents error in javascript due to the syntax "then (result) => "or more specific" = > "as in the code below, is there any other option?

Android Studio Message: I / chromium: [INFO: CONSOLE (244)] "Uncaught SyntaxError: Unexpected token = >", source: http: // ........

pagarme.client.connect({ encryption_key: 'ek_test_eee777dddsss5555' })
  .then(client => client.security.encrypt(card))
  .then(card_hash => {
    
asked by anonymous 13.07.2018 / 03:12

1 answer

-2

The => sign is a different notation for creating functions, called arrow function . For this particular case, just replace the form code in doing the functions in the traditional way, ie:

That:

parametro => {...} // arrow function

Turn this over:

function(parametro) { return ...} // função tradicional

Remembering the following: the arrow-shaped functions do not need return , since the traditional functions require, so you will have to add this as well.

Note: There are considerations about the difference between arrow functions and traditional functions, but I do not have enough knowledge to list all of them, so I leave the link below for discussion of these differences. For your problem in question the proposed solution is valid.

What does the "=> operator?" mean

    
13.07.2018 / 14:13