Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

notification on asynchronous processing that isn't one of my sheet workers

When updating a lot of attributes in the 5e OGL sheet at once (this happens in Beyond Importer), a lot of asynchronous updates of dependent things happen. Is there a way to observe completion of these so I know when they are done? Basically I am looking for something like onSheetWorkerCompleted but for all the work that happens in the sheet that isn't one of my attribute updates.
follow up:  I think this may just be triggers that are run when the sheet is opened (event listeners in the 5e OGL file) so there is probably nothing that can be done, unless there is a flag I can set somewhere to disable this sort of processing.   For now, I am working around it by changing things in the correct order, so that I don't care as much if these updates (like 'update_class') fire.
1539191400
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, you can watch for completed sheetworkers using the onSheetWorkerCompleted() function after you use .setWithWorker(). This has a major caveat though. onSheetWorkerCompleted() executes it's callback when the first sheetworker executed is completed (essentially at the first setAttrs() call in the sheet I believe). So, if the sheet is using cascading sheetworkers, you'll have an issue. Alternatively, I think (haven't had a chance to test this yet) you can use the new API version of setAttrs() to combine the effects of .setWithWorker and onSheetWorkerCompleted.
Yes, great.  That's exactly what I ended up doing.  I ended up making a work queue of attributes to write (for those I want to write carefully) and sending each of them to .setWithWorker and then doing the next one onSheetWorkerCompleted.   That works ok but it obviously a bit of overhead :) writing everything one at a time.  A lot nicer for debugging! Anyway, I am very interested in "new" setAttrs that you mention if it actually waits for all the events that trigger, including the event handlers in the OGL sheet.
clarification:  I want to use setAttrs with silenced updates from an API Script, not from the sheet.   It does not appear this function is available from there?
1539193746
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
It should have the capability of doing silence, I haven't used it yet though. However, it won't wait till all sheet workers have fired,it'll behave as your setwitheorker and on completed combo does, it'll just combine that into one function.
oh I found it... I could only find the doc for the Sheet version of setAttrs (where you don't specify the character) until I found the doc here <a href="https://app.roll20.net/forum/post/6223396/api-updates-3-slash-27-slash-2018" rel="nofollow">https://app.roll20.net/forum/post/6223396/api-updates-3-slash-27-slash-2018</a> it does support silencing, so I can do some interesting things with that. &nbsp;Thanks!