ShareLink - trigger event before appearing

Hi Community,

I have a question regarding ShareLink. In the documentation you pass it an array of items or as a single item.

The way I have previously setup my share sheet was a button would trigger an event, that would check what has been selected. if nothing was selected then no share sheet would appear, is something was selected, then those selected items are exported and the share sheet gets the path to the folder.

Using ShareLink I have been trying to figure out the best way to implement the same functionanilty but utilising ShareLink. If I pass the function get_export_location(), to the share sheet that will work as long as something is selected, if nothing is selected an empty array is returned but the share sheet still appears.

Should I wrap the ShareLink in a Button, that checks for the selection before passing it to the ShareLink, or am I thinking about the design of the api incorrectly. As I have tried this but the ShareLink does not appear.

[Export Button Pressed] > [Evaluate Selection] > [if selection, show ShareLink]

Any help would be greatly appreciated.

Thanks, Simon

ShareLink - trigger event before appearing
 
 
Q