onClickEventJS top-level constant

String const onClickEventJS

Implementation

const onClickEventJS = '''
function onClickEvent (event) {
  const id = event.target.id

  const boundingClientRect = event.target.getBoundingClientRect()

  $jujubaFlutterChannelName.postMessage(JSON.stringify({
    id: id,
    elementX: boundingClientRect.x,
    elementY: boundingClientRect.y,
    cursorX: event.x,
    cursorY: event.y
  }));
  console.log(event.target.id)
}
''';