INNER CODE UNIT · TypeScript

cursorSvg

aws-devtools-labs/aws-blocks · native/swift/Demo/typescript-demo/src/index.ts:332

function cursorSvg(color: string): string {
  return `<svg viewBox="0 0 24 24" fill="${esc(color)}" xmlns="http://www.w3.org/2000/svg">
    <path d="M5 3l14 8-6.5 1.5L11 19z" stroke="#000" stroke-width="1"/>
  </svg>`;
}

function getOrCreateCursor(id: string, color: string): HTMLElement {
  let el = cursors.get(id);
  if (!el) {
    el = document.createElement('div');
    el.className = 'cursor-dot';
    el.innerHTML = `${cursorSvg(color)}<span class="label" style="background:${esc(color)};color:#000">${esc(id)}</span>`;
    realtimeArea.appendChild(el);
    cursors.set(id, el);
  }
  return el;
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…