万本电子书0元读

万本电子书0元读

顶部广告

Learning ClojureScript电子书

售       价:¥

60人正在读 | 0人评论 9.8

作       者:W. David Jarvis,Rafik Naccache,Allen Rohner

出  版  社:Packt Publishing

出版时间:2016-06-01

字       数:412.3万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:此类商品不支持退换货,不支持下载打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Master the art of agile single page web application development with ClojureScript About This Book Set up interactive development workflows for the browser or Node.js thanks to the ClojureScript ecosystem Learn the basics of interactive single page web app development taking advantage of the functional nature of ClojureScript Delve into advanced rich web application development concepts such as Om, along with core.async, using zippers and logic programming, and preparing code for production with testing or optimizing via the Google Closure Compiler Who This Book Is For This book is for web application developers who want to benefit from the power of ClojureScript to get an agile and highly productive development platform that targets mainly browser JavaScript. You are not required to be fluent in Clojure, but it will be easier for you if you have a basic understanding of browser and server-side JavaScript. What You Will Learn Understand how the ClojureScript compiler operates Set up interactive development workflows for ClojureScript Grasp the basics of the ClojureScript language, including basic syntax, data structures, variable scoping, namespaces, and finally the powerful sequence abstraction Delve into advanced concepts such as functional programming, macro writing, asynchronous programming, app routing, and real-time web Develop simple one page web applications Explore techniques to make your web apps aware of the external world through external or embedded database access or Oauth 2 integration Learn more advanced ClojureScript concepts like in app routing, real-time web Prepare your work for production, getting insights into optional type-checking, writing portable Clojure/ClojureScript code, and testing In Detail Clojure is an expressive language that makes it possible to easily tackle complex software development challenges. Its bias toward interactive development has made it a powerful tool, enabling high developer productivity. In this book, you will first learn how to construct an interactive development experience for ClojureScript.. You will be guided through ClojureScript language concepts, looking at the basics first, then being introduced to advanced concepts such as functional programming or macro writing. After that, we elaborate on the subject of single page web applications, showcasing how to build a simple one, then covering different possible enhancements. We move on to study more advanced ClojureScript concepts, where you will be shown how to address some complex algorithmic cases. Finally, you'll learn about optional type-checking for your programs, how you can write portable code, test it, and put the advanced compilation mode of the Google Closure Compiler to good use. Style and approach This book is a comprehensive reference guide on ClojureScript development for the front end, and will gradually help you master interactive ClojureScript development workflows, through detailed step-by-step information illustrated with annotated code samples.
目录展开

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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部