Advertisement
Guest User

Untitled

a guest
Aug 28th, 2023
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. /**
  3.  * ProductameSearchPanel
  4.  *
  5.  * @link    https://developer.lucid.co/extension-api/#hard-refresh-action#persistent-panels
  6.  * @link    https://developer.lucid.co/extension-api/#communicating-with-custom-ui
  7.  * @access  public
  8.  */
  9. class ProductameSearchPanel extends Panel {
  10.  
  11.     /**
  12.      * (constructor)
  13.      *
  14.      * @access  private
  15.      * @param   EditorClient client
  16.      * @return  void
  17.      */
  18.     constructor(client: EditorClient) {
  19.         super(client, {
  20.             title: 'Productame',
  21.             content: getContent(),
  22.             iconUrl: 'https://example.com/favicon-96x96.png',
  23.             location: PanelLocation.ImageSearchTab,
  24.             // location: PanelLocation.RightDock,
  25.             width: 280,
  26.             persist: true
  27.         });
  28.         // console.log('meow', window.Productame);
  29.     }
  30.  
  31.     /**
  32.      * sendUserIdToFrame
  33.      *
  34.      * @access  private
  35.      * @return  void
  36.      */
  37.     private async sendUserIdToFrame() {
  38.         this.sendMessage({
  39.             userId: 'qqq'
  40.         });
  41.         // var userId = user.id;
  42.         // this.sendMessage({
  43.         //     action: 'receiveUserId',
  44.         //     paylod: {
  45.         //         userId: userId
  46.         //     }
  47.         // });
  48.     }
  49.  
  50.     /**
  51.      * messageFromFrame
  52.      *
  53.      * From docs:
  54.      * "When the app is loaded, it will send a message asking for an update."
  55.      *
  56.      * @access  protected
  57.      * @param   String message
  58.      * @return  void
  59.      */
  60.     protected async messageFromFrame(message: any) {
  61.         var action = message.action || null;
  62.         if (action === 'getUserId') {
  63.             this.sendUserIdToFrame();
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement