<commit_before><html>
  <head>
    <script src="../lib/jquery.js"></script>
    <script src="../dist/Bacon.js"></script>
    <script>
      $(function() {
        $("#clikme").asEventStream("click").subscribe(function(event) {
          alert("mmmm... bacon!")
        })

        function always(value) { return function() { return value }}
        
        function keyCodeIs(keyCode) { 
          return function(event) { return event.keyCode == keyCode }
        }

        function keyDowns(keyCode) { 
          return $(document).asEventStream("keydown").filter(keyCodeIs(keyCode))
        }

        function keyUps(keyCode) { 
          return $(document).asEventStream("keyup").filter(keyCodeIs(keyCode))
        }

        function keyState(keyCode) { 
          return keyDowns(keyCode).map(always("DOWN"))
            .merge(keyUps(keyCode).map(always("UP"))).toProperty("UP")
        }

        keyState(32).onValue(function(state) {
          $("#state").text(state)
        })
        function isEmpty(s) { return s.length == 0 }
        $("#enabling input").asEventStream("keyup").map(function(event) { return $(event.target).val()}).toProperty("").map(isEmpty).assign($("#enabling button"), "attr", "disabled") 

      })
    </script>
  </head>
  <body>
    <h1>bacon.js example page</h1>
    <div>
      <h2>Simplest example:</h2>
      <span id="clikme">click me</span>
    </div>
    <div>
      <h2>Combinators example</h2>
      SPACEBAR status=<span id="state"></span>
    </div>
    <div id="enabling">
      <h2>Enable/disable</h2>
      <input type="text" placeholder="required field"><commit_msg>Rename elements in examples.html to clarify purpose in the context of FRP.<commit_after><html>
  <head>
    <script src="../lib/jquery.js"></script>
    <script src="../dist/Bacon.js"></script>
    <script>
      $(function() {
        $("#clikme").asEventStream("click").subscribe(function(event) {
          alert("mmmm... bacon!")
        })

        function always(value) { return function() { return value }}
        
        function keyCodeIs(keyCode) { 
          return function(event) { return event.keyCode == keyCode }
        }

        function keyDownEvents(keyCode) { 
          return $(document).asEventStream("keydown").filter(keyCodeIs(keyCode))
        }

        function keyUpEvents(keyCode) { 
          return $(document).asEventStream("keyup").filter(keyCodeIs(keyCode))
        }

        function keyStateProperty(keyCode) { 
          return keyDownEvents(keyCode).map(always("DOWN"))
            .merge(keyUpEvents(keyCode).map(always("UP"))).toProperty("UP")
        }

        keyStateProperty(32).onValue(function(value) {
          $("#spacebar-value").text(value)
        })

        function isEmpty(s) { return s.length == 0 }

        $("#enabling input").asEventStream("keyup").map(function(event) { return $(event.target).val()}).toProperty("").map(isEmpty).assign($("#enabling button"), "attr", "disabled") 
      })
    </script>
  </head>
  <body>
    <h1>bacon.js example page</h1>
    <div>
      <h2>Simplest example:</h2>
      <span id="clikme">click me</span>
    </div>
    <div>
      <h2>Combinators example</h2>
      SPACEBAR value=<span id="spacebar-value"></span>
    </div>
    <div id="enabling">
      <h2>Enable/disable</h2>
      <input type="text" placeholder="required field">
{'fraction_non_alphanumeric': 0.17652303120356613, 'fraction_numerical': 0.006537890044576523, 'mean_word_length': 2.6310679611650487, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, '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': '7112292', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1032, 'n_words': 166}