Delayed compute of part of definition

What is the best way to trigger a delayed compute of parts of a definition that are not displayed to the online user?
It may be the case that we want this triggered when the Shapediver email component is triggered, or perhaps when a user commits to purchase once completing their design.

@John_Bland, you are basically asking all the questions I’m having on the back of my mind, too! This is very handy :wink: +1

1 Like

We usually recommend to use boolean toggles in Grasshopper that prevent the computation of any logic that is not necessary for visualization. You can then hook any user action on your website (for example a purchase button) to a function that will first enable the boolean toggle and, once enabled, trigger the export. Something like this:

button.addEventListener("click", function(){
    api.parameters.updateAsync({name: "MyBooleanToggle", value: true}).then(function(){
           api.exports.requestAsync({name: "MyExportAsset"});

At present, I do have the part I want to delay and not present to the customer on a Boolean.
I just wanted a way to make sure it was always triggered if the user commits to a purchase.
So it’s possible with your code.
This code and the code you posted on my other post are both for the Shapediver API?

I have been talking to a few developers Ezequiel recommended and will be using one of them to implement your API.

As such, they would use this code in the API to trigger what I want?

Precisely. Those API examples can be used by your developers to produce the behaviour you want.

Thank you