I’m trying to work on a solution to create Google Static Maps links via the datamapper. We need to sign the request and that needs to be base64 encoded. Trying to use btoa() fails. Is this possible in the data mapper?
Is there a reference to what parts of JS are available and what isn’t in the version implemented by Objectif Lune?
The btoa() method is generally called on the window scope which isn’t available in the data mapper.
Fear not…the btoa() function below can be used to encode any ASCII string. In addition, if your string contains unicode characters, then use the b64EncodeUnicode() function below instead which also calls the btoa() function:
//b64EncodeUnicode('? à la mode'); // "4pyTIMOgIGxhIG1vZGU="
//btoa('Hello World!'); //SGVsbG8gV29ybGQh