app/scripts/views/ChannelGuide.js
/**
   * A helper to transform Base64 encoded string into a Uint8Array.
   *
   * Source: https://github.com/GoogleChromeLabs/web-push-codelab/blob/master/app/scripts/main.js
   *
   * @param {String} base64String - The Base64 encoded string
   * @return {Uint8Array} The converted array in unsigned 8-bit integer
   */
A helper to transform Base64 encoded string into a Uint8Array.

@param {String} base64String - The Base64 encoded string
@return {Uint8Array} The converted array in unsigned 8-bit integer
A helper to transform Base64 encoded string into a Uint8Array . @param { String } base64String - The Base64 encoded string @return { Uint8Array } The converted array in unsigned 8 - bit integer
static urlB64ToUint8Array(base64String) {
     const padding = '='.repeat((4 - base64String.length % 4) % 4);
     const base64 = (base64String + padding)
       .replace(/\-/g, '+')
       .replace(/_/g, '/');
     const rawData = window.atob(base64);
     const outputArray = new Uint8Array(rawData.length);
     for (let i = 0; i < rawData.length; ++i) {
       outputArray[i] = rawData.charCodeAt(i);
     }
     return outputArray;
   }
static urlB64ToUint8Array ( base64String ) { const padding = '=' . repeat ( ( 4 - base64String . length % 4 ) % 4 ) ; const base64 = ( base64String + padding ) . replace ( / \- / g , '+' ) . replace ( / _ / g , '/' ) ; const rawData = window . atob ( base64 ) ; const outputArray = new Uint8Array ( rawData . length ) ; for ( let i = 0 ; i < rawData . length ; ++ i ) { outputArray [ i ] = rawData . charCodeAt ( i ) ; } return outputArray ; }
A helper to transform Base64 encoded string into a Uint8Array.
A helper to transform Base64 encoded string into a Uint8Array .