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

sheet worker - setAttrs callback doesn't work

1474639795

Edited 1474641192
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I think I may have found a bug with the character sheet web workers' setAttrs() function. After some point, it seems to stop invoking the callback for setAttrs. Here, I try to invoke the use setAttrs' callback to resolve a Promise. The callback doesn't seem to ever get invoked though. debug ends up getting set to 42, and not 'this is a test'. (() => {   'use strict';   /**    * Promise-wrapped setAttrs.    */   function _setAttrs(values) {     return new Promise((resolve, reject) => {       setAttrs(values, undefined, resolve);     });   }   on('sheet:opened', () => {     Promise.resolve(42)     .then(value => {       return _setAttrs({         debug: value       });     })     .then(value => {       return _setAttrs({         debug: 11       });     })     .then(value => {       setAttrs({         debug: 'this is a test'       });     })     .catch(err => {       _setAttrs({         debug: err.toString()       });     });   }); })(); Here is the same code without using setAttrs, just to show that the way I'm using Promises isn't the issue. Here, debug is set to 'this is a test' at the end as expected. (() => {   'use strict';   /**    * Promise-wrapped setAttrs.    */   function _setAttrs(values) {     return new Promise((resolve, reject) => {       resolve();     });   }   on('sheet:opened', () => {     Promise.resolve(42)     .then(value => {       return _setAttrs({         debug: value       });     })     .then(value => {       return _setAttrs({         debug: 11       });     })     .then(value => {       setAttrs({         debug: 'this is a test'       });     })     .catch(err => {       _setAttrs({         debug: err.toString()       });     });   }); })(); After some further testing, it seems like I can invoke the Promises' resolve from outside the setAttrs() callback, but not from inside it. This further confirms that something weird is going on with how things are working inside setAttrs()'s callback.
1474934417
Gid
Roll20 Team
Thank you for bringing this to our attention. I've written up a bug ticket for this.