src/state/REPLState.js
/**
   * Link gets the sharing the sharing link
   * for the given REPL state and updates the id
   * @returns {Promise<string>} String URL.
   */
Link gets the sharing the sharing link
for the given REPL state and updates the id
@returns {Promise} String URL.
Link gets the sharing the sharing link for the given REPL state and updates the id @returns { Promise } String URL .
async Link(id, setId) {
    try {
      let message;
      if (!id) {
        message = await this.New();
        setId(message.id);
      } else {
        message = await this.Save(id);
      }
      return (
        window.location.href.split("/").slice(0, 3).join("/") + message.url
      );
    } catch (err) {
      console.error(err);
      return err;
    }
  }
async Link ( id , setId ) { try { let message ; if ( ! id ) { message = await this . New ( ) ; setId ( message . id ) ; } else { message = await this . Save ( id ) ; } return ( window . location . href . split ( "/" ) . slice ( 0 , 3 ) . join ( "/" ) + message . url ) ; } catch ( err ) { console . error ( err ) ; return err ; } }
Link gets the sharing the sharing link
 for the given REPL state and updates the id
 @returns {Promise<string>} String URL.
Link gets the sharing the sharing link for the given REPL state and updates the id @returns { Promise<string > } String URL .
// https://stackoverflow.com/questions/6941533/get-protocol-domain-and-port-from-url