Return data from client side action

I’m creating a Bubble plugin and one of the action should send message view chrome.runtime and return data, but I can’t define return type in client side action.

I also tried, switching to server side action but it then is throws an error:

ReferenceError: chrome is not defined
at eval (eval at build_function (/var/task/index.js:53:12), :4:5)

Is there any way to add return type to client side action or make chrome.runtime available on server side action?

Client side actions do not return value. It is a well known limitation.
Usually the workaround is:

  • create an element in the plugin
  • add states for the values that you want to “return”
  • add an event, it will signal to the plugin user that the data in the state has been updated
  • add a element action that executes your business logic, publishes the “returned” data to the relative states, triggers the event

Needless to say that chrome.runtime is an API available for chrome extension only so of course you can’t have it in a server side action because it exists only in the context of a chrome extension.

1 Like