<commit_before>class PostMessage

  @postMessage: (message, targetOrigin) =>

    callbacks = {}

    escapedJSONMessage = escape(JSON.stringify(message))

    steroids.nativeBridge.nativeCall
      method: "broadcastJavascript"
      parameters:
        javascript: "steroids.PostMessage.dispatchMessageEvent('#{escapedJSONMessage}', '*');"
      successCallbacks: [callbacks.onSuccess]
      recurringCallbacks: [callbacks.onFailure]



  @dispatchMessageEvent: (escapedJSONMessage, targetOrigin) =>
    message = JSON.parse(unescape(escapedJSONMessage))

    e = document.createEvent "MessageEvent"

    #                  type       bubles etc    message    origin
    e.initMessageEvent "message", false, false, message, "", "", window, null

    window.dispatchEvent e<commit_msg>removed undefined and thus noop callbacks from postmessage nativecall<commit_after>class PostMessage

  @postMessage: (message, targetOrigin) =>
    escapedJSONMessage = escape(JSON.stringify(message))

    steroids.nativeBridge.nativeCall
      method: "broadcastJavascript"
      parameters:
        javascript: "steroids.PostMessage.dispatchMessageEvent('#{escapedJSONMessage}', '*');"
      successCallbacks: []
      recurringCallbacks: []



  @dispatchMessageEvent: (escapedJSONMessage, targetOrigin) =>
    message = JSON.parse(unescape(escapedJSONMessage))

    e = document.createEvent "MessageEvent"

    #                  type       bubles etc    message    origin
    e.initMessageEvent "message", false, false, message, "", "", window, null

    window.dispatchEvent e
{'fraction_non_alphanumeric': 0.10261312938177183, 'fraction_numerical': 0.0, 'mean_word_length': 3.7005988023952097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6237356', 'n_tokens_mistral': 441, 'n_tokens_neox': 415, 'n_words': 84}