Giter Club home page Giter Club logo

reacl-c-basics's Introduction

Reacl-c-basics

This is a collection of utilities often useful when developing with the Reacl-C web programming library for ClojureScript

Latest Version Tests Status

Documentation

The API documentation for the latest release are available here.

The contents at a glance

The following sections give a brief overview of the most used namespaces of the library.

Forms and input elements

The namespace reacl-c-basics.forms.core contains functions very similar to the corresponding DOM elements input, textarea, select and form, but with the most relevant state (the value entered by the user) as their item state.

The input elements also support the :multiple attribute when possible, and special new attributes are added for the HTML5 Form Validation API.

Note: reacl-c-basics.forms is deprecated.

Advanced and custom input types

The namespace reacl-c-basics.forms.types contains additional values - called types - that can be used for the :type attribute of the input items of reacl-c-basics.forms.core. It also contains functions to create new types.

The most used types are: opt-integer, which changes the state of the input item to either nil or an integer number, and opt-fixnum, which changes enables the user to enter a floating point number, but only with a fixed number of decimals.

Some of the type values, will actually change the reacl-c-basics.forms.core/input item into a textbox or select item, namely multiline-string and enum or string-enum respectively.

Ajax requests

The namespace reacl-c-basics.ajax gives you mostly invisible items that perform an Ajax request and give you easy access to the results.

Client side routing

For an easy setup of HTML5 Client Side Routing, look at the namespaces starting with reacl-c-basics.pages.

Timers and animation frames

The core namespace of the library reacl-c-basics.core contains useful subscriptions to a JavaScript timer (timeout and interval), and to animation frame timestamps (animation-frame and animation-frames).

reacl-c-basics's People

Contributors

dependabot[bot] avatar dfrese avatar kenranunderscore avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reacl-c-basics's Issues

debounce toggles state when reacl-c.core/init is involved

This code performs a 1 second debounce as I would expect:

(ns todomvc.core
  (:require [reacl-c.main :as main]
            [reacl-c.dom :as dom :include-macros true]
            [reacl-c.core :as c :include-macros true]
            [reacl-c-basics.debounce :as debounce]))

(defn init []
  (main/run
    (.getElementById js/document "app")

    (c/fragment
     (c/dynamic pr-str)
     (debounce/debounce-delay 1000 (c/with-state-as st
                                     (dom/div

                                      ;; add this line to notice the flip-flop behaviour:
                                      ;; (c/init (c/return))

                                      (dom/button {:onclick not}
                                                  (pr-str st))))))

    {:initial-state false}
    ))

When you uncomment the (c/init (c/return)) line, the behaviour changes: Now when you click the button, the state toggles between true and false every second.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.