Ooh, I thought this was likely common knowledge. The fact that you ask for the code gives me hope that I did something wrong, then. Here is the code excerpt: ...
5 var COFantasy2 = COFantasy2 || function() {
6 "use scrict";
...
2560 function treatSheetCommand(attr, nb = 0) {
2561 let jcmd = attr.get('current');
2562 if (jcmd === '' && nb < 2) {
2563 _.delay(function() {
2564 treatSheetCommand(attr, nb + 1);
2565 }, 2000);
2565 return;
2567 }
2568 let cmd;
2569 try {
2570 cmd = JSON.parse(jcmd);
2571 } catch (e) {
2572 error("Error parsing sheet command (" + jcmd + ")", attr);
2573 attr.remove();
2574 return;
2575 }
2576 if (cmd) {
2577 switch (cmd.action) {
2578 case 'alias':
...
2589 }
2590 attr.remove();
2591 }
2592
2593 function attributeAdded(attr) {
2594 let n = attr.get('name');
2595 if (n == 'cofantasy') treatSheetCommand(attr);
2596 }
...
2650 return {
...
2654 attributeAdded,
2655 };
2656 }();
2657
2558 on('ready', function() {
...
2664 on('add:attribute', COFantasy2.attributeAdded);
...
2669 }); Without the code from line 2562 to 2567, the variable jcmd is empty most of the time, even though I can see on the sheet that the attribute is filled with the expected value. Sometimes it is ok for a whole session, most of the time is is always empty during a session, and once I saw the behavior change in the middle of a session. I've had similar issues with token names at token creation for years. Maybe I wrote this code to wait until the token name is actually filled for nothing?