The ever lasting FIXME in holder.js #536

Open
opened 2026-02-20 10:18:29 -05:00 by deekerman · 0 comments
Owner

Originally created by @RaphaelAlvez on GitHub (Jul 12, 2022).

Holder.js line 72

async onChildAdd(child, oldParentID) {
    await super.onChildAdd(child, oldParentID);
    if(child.get('type') == 'deck')
      return;

    if(this.get('childrenPerOwner'))
      await child.set('owner', child.targetPlayer||playerName);

    if(this != child.currentParent) { // FIXME: this isn't exactly pretty
      let toProcess = [ child ];
      if(child.get('type') == 'pile')
        toProcess = child.children();
      for(const property in this.get('onEnter')) {
        for(const w of toProcess) {
          if(tracingEnabled)
            sendTraceEvent('onEnter', { w: w.get('id'), child: child.get('id'), property, value: this.get('onEnter')[property], toProcess: toProcess.map(w=>w.get('id')) });
          await w.set(property, this.get('onEnter')[property]);
        }
      }
    }
  }
Originally created by @RaphaelAlvez on GitHub (Jul 12, 2022). Holder.js line 72 ``` async onChildAdd(child, oldParentID) { await super.onChildAdd(child, oldParentID); if(child.get('type') == 'deck') return; if(this.get('childrenPerOwner')) await child.set('owner', child.targetPlayer||playerName); if(this != child.currentParent) { // FIXME: this isn't exactly pretty let toProcess = [ child ]; if(child.get('type') == 'pile') toProcess = child.children(); for(const property in this.get('onEnter')) { for(const w of toProcess) { if(tracingEnabled) sendTraceEvent('onEnter', { w: w.get('id'), child: child.get('id'), property, value: this.get('onEnter')[property], toProcess: toProcess.map(w=>w.get('id')) }); await w.set(property, this.get('onEnter')[property]); } } } } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/virtualtabletop#536
No description provided.