Programming Elm: Build Safe and Maintainable Front-End Applications 1680502859

1,212 193 4MB

English Pages 452 Year 2019

Report DMCA / Copyright

DOWNLOAD FILE

Programming Elm: Build Safe and Maintainable Front-End Applications
 1680502859

Table of contents :
 Preface......Page 12
Why Elm?......Page 13
Who Is This Book For?......Page 15
What’s In This Book?......Page 16
How to Read This Book......Page 19
Online Resources......Page 20
Acknowledgements......Page 21
1. Get Started with Elm......Page 23
Get Started with Functions......Page 25
Use Static Types......Page 38
Build a Static App......Page 50
What You Learned......Page 63
2. Create Stateful Elm Applications......Page 64
Apply the Elm Architecture......Page 65
Create the View......Page 72
Handle State Changes......Page 76
The Elm Architecture Life Cycle......Page 90
What You Learned......Page 93
3. Refactor and Enhance Elm Applications......Page 94
Refactor with Good Practices......Page 95
Comment on Photos......Page 102
What You Learned......Page 115
4. Communicate with Servers......Page 116
Safely Decode JSON......Page 117
Fetch from HTTP APIs......Page 135
What You Learned......Page 152
5. Go Real-Time with WebSockets......Page 153
Load Multiple Photos......Page 154
Receive Photos from WebSockets......Page 164
What You Learned......Page 179
6. Build Larger Applications......Page 180
Organize the View......Page 182
Simplify Messages......Page 192
Use Nested State......Page 197
Use Extensible Records......Page 205
Remove View Duplication......Page 210
Prevent Invalid States......Page 220
What You Learned......Page 224
7. Develop, Debug, and Deploy with Powerful ToolingDevelop, Debug, and Deploy with Powerful Tooling......Page 226
Debug Code with the Debug Module......Page 227
Rapidly Develop and Deploy Elm Applications......Page 244
What You Learned......Page 259
8. Integrate with JavaScript......Page 260
Embed an Elm Application......Page 261
Upload Images with Ports......Page 271
Display Uploaded Images......Page 283
What You Learned......Page 293
9. Test Elm Applications......Page 296
Test-Driven Development in Elm......Page 297
What to Expect When You’re Expecting......Page 307
Fuzz Your Tests......Page 316
Test an Application......Page 327
What You Learned......Page 340
10. Build Single-Page Applications......Page 341
Build a Skeleton SPA......Page 343
Route to a Component Page......Page 354
Welcome Back Picshare......Page 363
Handle Dynamic Routes......Page 373
What You Learned......Page 386
11. Write Fast Applications......Page 388
Benchmark Code......Page 389
Traverse Large Lists......Page 399
Get Lazy......Page 411
Build Lazy Applications......Page 420
What You Learned......Page 433
A1. Install Elm......Page 435
All Roads Lead to Node......Page 436
Install the Elm Compiler......Page 437
Install Development Tools......Page 438
A2. Run the Local Server......Page 440
Install and Run the Server......Page 441
A3. Elm Package Versions......Page 443
Install an Older Package Version......Page 444

Polecaj historie