<commit_before>(ns cljs-browser-repl.console.echo
  (:require [reagent.core :as reagent]
            [cljs-browser-repl.app :as app]
            [cljs-browser-repl.console :as console]))

(defn echo-prompt
  [console]
  (.Prompt console
           true
           (fn [input]
             (console/write-output! console (str input "\n"))
             (echo-prompt console))))

(defn echo-console-did-mount
  "The state is the app-state atom."
  []
  (js/$
   (fn []
     (let [jqconsole (console/new-jqconsole "#echo-console"
                                            {:prompt-label "Let me echo it for you: "})]
       (app/add-console! :echo-console jqconsole)
       (echo-prompt jqconsole)))))

(defn echo-console-render []
  [:div.console-container
   [:div#echo-console.console.echo-console]])

(defn echo-component
  "Mimics the sample in the JQConsole wiki:
  <script>
      $(function () {
        var jqconsole = $('#console').jqconsole('Hi\n', '>>>');
        var startPrompt = function () {
          // Start the prompt with history enabled.
          jqconsole.Prompt(true, function (input) {
            // Output input with the class jqconsole-output.
            jqconsole.Write(input + '\n', 'jqconsole-output');
            // Restart the prompt.
            startPrompt();
          });
        };
        startPrompt();
      });
  </script>

  And the cookbook entry at https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/data-tables
  The state is an atom."
  []
  (reagent/create-class {:reagent-render echo-console-render
                         :component-did-mount echo-console-did-mount}))
<commit_msg>Commented out add-console! in echo as now we are using re-frame.<commit_after>(ns cljs-browser-repl.console.echo
  (:require [reagent.core :as reagent]
            [cljs-browser-repl.app :as app]
            [cljs-browser-repl.console :as console]))

(defn echo-prompt
  [console]
  (.Prompt console
           true
           (fn [input]
             (console/write-output! console (str input "\n"))
             (echo-prompt console))))

(defn echo-console-did-mount
  "The state is the app-state atom."
  []
  (js/$
   (fn []
     (let [jqconsole (console/new-jqconsole "#echo-console"
                                            {:prompt-label "Let me echo it for you: "})]
       ;; (app/add-console! :echo-console jqconsole)
       (echo-prompt jqconsole)))))

(defn echo-console-render []
  [:div.console-container
   [:div#echo-console.console.echo-console]])

(defn echo-component
  "Mimics the sample in the JQConsole wiki:
  <script>
      $(function () {
        var jqconsole = $('#console').jqconsole('Hi\n', '>>>');
        var startPrompt = function () {
          // Start the prompt with history enabled.
          jqconsole.Prompt(true, function (input) {
            // Output input with the class jqconsole-output.
            jqconsole.Write(input + '\n', 'jqconsole-output');
            // Restart the prompt.
            startPrompt();
          });
        };
        startPrompt();
      });
  </script>

  And the cookbook entry at https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/data-tables
  The state is an atom."
  []
  (reagent/create-class {:reagent-render echo-console-render
                         :component-did-mount echo-console-did-mount}))

{'fraction_non_alphanumeric': 0.14107142857142857, 'fraction_numerical': 0.0, 'mean_word_length': 2.0976958525345624, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3390943', 'n_tokens_mistral': 1037, 'n_tokens_neox': 997, 'n_words': 238}