售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Learning ClojureScript
Learning ClojureScript
Credits
Foreword
About the Authors
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Ready for ClojureScript Development
Getting familiar with the ClojureScript ecosystem
Inside the ClojureScript compiler
Working with the ClojureScript REPL
Live coding ClojureScript on top of nREPL with Piggieback and Weasel
Working with Piggieback
Setting up Weasel with PiggieBack for browser live coding
ClojureScript REPLs on Node.js with Piggieback
Live coding ClojureScript with Figwheel
Setting up Figwheel for browser live coding
Node.js interactive development workflows with Figwheel
Setting integrated development environments for ClojureScript
Working on Emacs with Piggieback and Weasel on CIDER
Installing CIDER
Working with Clojure and ClojureScript REPLs on CIDER
Working on Emacs with Figwheel and inf-clojure
Installing inf-clojure
Configuring inf-clojure to run Figwheel as a Clojure subprocess
Summary
2. ClojureScript Language Fundamentals
Understanding ClojureScript functions
Functions
Multiarity and variadic functions
Anonymous functions
Side effects
Local variables
The ClojureScript data structures
Scalar types
Numbers
Strings and characters
Nil
Boolean values and truthiness
Keywords
Symbols
ClojureScript collections
Lists
Vectors
When should I use lists versus vectors?
Maps
Different types of maps
Sets
Sequences
Laziness
Collection protocols
Sequential
Associative
Sorted
Counted
Reversible
Object-oriented programming
Protocols
Types
Records
Extending types and protocols
Reify
Other ClojureScript types
Regular expressions
Atoms
Immutability
Advanced destructuring and namespaces
Destructuring
Namespaces
JavaScript interoperability
JavaScript collections
Arrays
JavaScript objects
JS interop syntax
The Google Closure Compiler and using external JavaScript libraries
Referencing external libraries with externs
Bundling external libraries
Google Closure Compiler compatible code
Foreign JavaScript
CLJSJS
Summary
3. Advanced ClojureScript Concepts
Functional programming concepts
Loops and iteration
Loop and recur functions
for
dotimes
doseq
doall
Higher-order functions
map
The filter and remove functions
reduce
Transducers
Control flow
if and when
if-let and when-let
cond and condp
case
Exception handling
Writing macros for ClojureScript
read and eval
Your first macro
Writing more advanced macros
Gensyms and local binding in macros
Don't repeat yourself!
A personal favorite – Threading macros
A closing note on macros
Concurrent design patterns using core.async
JavaScript is event-driven by default
Event-driven programming in ClojureScript
The Communicating Sequential Processes concurrency model
Getting started with core.async
Background listeners
Errors and core.async
Summary
4. Web Applications Basics with ClojureScript
Raw DOM manipulation and events handling
Interacting with the browser using the Google Closure Library
Dommy – An idiomatic ClojureScript library for the DOM
Client-side templating in ClojureScript
CSS preprocessors in ClojureScript
Summary
5. Building Single Page Applications
Understanding Single Page Appliactions
The tradeoffs of SPAs
Richer UI
Easier to deal with client-side data
Easier to deal with AJAX
Faster client interactions once the page is loaded
More development work
Legacy browser support is harder
Understanding Om
Understanding React
The React terminology
The components of an SPA
Setting up
What just happened?
Child components
Items in the Om constructor signature
Cursors
owner
Opts
Input
Rendering
The React diffing algorithm
Differences between Om and React
Components
State models
Cursors
Determining the size of a component
Constructing
The local state
Life cycle protocols
Using third-party JS
jQuery listeners
AJAX
Dependencies
The server
Transit
Ring
CORS
Data
Routing and HTML5 history
pushState
Navigation
Summary
6. Building Richer Web Applications
Real-time communication with websockets
Understanding the websocket protocol
Initialization
Sending messages
Understanding Chord
Using Datascript
Understanding the Datascript/Datomic data model
A basic query
Query arguments
Schema
Understanding db.type/ref
Cardinality
Pull
Finding results
Unification
Predicate expressions
Indexes
Differences between Datomic and Datascript
Why Datascript?
Improving load times
ClojureScript modules
Preparing for modules
Getting started
Route definition
Loading modules
Fixing development mode
.cljc and server-side rendering
.cljc
Schema and input validation
Server-side rendering
Setting up the project
Understanding Foam
Summary
7. Going Further with ClojureScript
Pattern matching with core.match
Configuring our project
Getting started with core.match
Matching collections
Guards and function applications
Wrapping up
Exploring nested data structures with clojure.zip
Example – Replacing values in a tree
Example – Removing values from a tree
Further possibilities
Declaratively solving problems with core.logic
Configuring our project
Getting started with core.logic
Advanced core.logic
Going even further
Runtime data validation using schema
Configuring our project
A quick introduction to schema
Collection schemas
Function schemas
Advanced schema validation
Schema coercion
Summary
8. Bundling ClojureScript for Production
Testing your application with cljs.test
Using doo for easier testing configuration
Testing fixtures
Asynchronous testing
Asynchronous fixtures
Advanced ClojureScript compilation options
Compilation optimization levels
Generating modules
Targeting a Node.js runtime
General configuration recommendations
Deploying Clojure and ClojureScript applications in a Docker container
Installing Docker
Compiling an Uberjar
Building a Docker container for our app
Summary
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜