售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
TypeScript Blueprints
TypeScript Blueprints
Credits
About the Author
About the Reviewer
www.PacktPub.com
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
Downloading the color images of this book
Errata
Piracy
Questions
1. TypeScript 2.0 Fundamentals
What is TypeScript?
Quick example
Transpiling
Type checking
Learning modern JavaScript
let and const
Classes
Arrow functions
Function arguments
Array spread
Destructuring
Template strings
New classes
Type checking
Primitive types
Defining types
Undefined and null
Type annotations
Summary
2. A Weather Forecast Widget with Angular 2
Using modules
Setting up the project
Directory structure
Configuring TypeScript
Building the system
The HTML file
Creating the first component
The template
Testing
Interactions
One-way variable binding
Event listeners
Adding conditions to the template
Directives
The template tag
Modifying the about template
Using the component in other components
Showing a forecast
Using the API
Typing the API
Creating the forecast component
Templates
Downloading the forecast
Adding @Output
The main component
Using our other components
Two-way bindings
Listening to our event
Geolocation API
Component sources
Summary
3. Note-Taking App with a Server
Setting up the project structure
Directories
Configuring the build tool
Type definitions
Getting started with NodeJS
Asynchronous code
Callback approach for asynchronous code
Disadvantages of callbacks
The database
Wrapping functions in promises
Connecting to the database
Querying the database
Understanding the structural type system
Generics
Typing the API
Adding authentication
Implementing users in the database
Adding users to the database
Testing the API
Adding CRUD operations
Implementing the handlers
Request handling
Writing the client side
Creating the login form
Creating a menu
The note editor
The main component
Error handler
Running the application
Summary
4. Real-Time Chat
Setting up the project
Configuring gulp
Getting started with React
Creating a component with JSX
Adding props and state to a component
Creating the menu
Testing the application
Writing the server
Connections
Typing the API
Accepting connections
Storing recent messages
Handling a session
Implementing a chat message session
Connecting to the server
Automatic reconnecting
Sending a message to the server
Writing the event handler
Creating the chat room
Two-way bindings
Stateless functional components
Running the application
Comparing React and Angular
Templates and JSX
Libraries or frameworks
Summary
5. Native QR Scanner App
Getting started with NativeScript
Creating the project structure
Adding TypeScript
Creating a Hello World page
Creating the main view
Adding a details view
Scanning QR codes
Type definitions
Implementation
Testing on a device
Adding persistent storage
Styling the app
Comparing NativeScript to alternatives
Summary
6. Advanced Programming in TypeScript
Using type guards
Narrowing
Narrowing any
Combining type guards
More accurate type guards
Assignments
Checking null and undefined
Guard against null and undefined
The never type
Creating tagged union types
Comparing performance of algorithms
Big-Oh notation
Optimizing algorithms
Binary search
Built-in functions
Summary
7. Spreadsheet Applications with Functional Programming
Setting up the project
Functional programming
Calculating a factorial
Using data types for expressions
Creating data types
Traversing data types
Validating an expression
Calculating expressions
Writing unit tests
Parsing an expression
Creating core parsers
Running parsers in a sequence
Parsing a number
Order of operations
Defining the sheet
Calculating all fields
Using the Flux architecture
Defining the state
Creating the store and dispatcher
Creating actions
Adding a column or a row
Changing the title
Showing the input popup
Testing actions
Writing the view
Rendering the grid
Rendering a field
Showing the popup
Adding styles
Gluing everything together
Advantages of Flux
Going cross-platform
Summary
8. Pac Man in HTML5
Setting up the project
Using the HTML5 canvas
Saving and restoring the state
Designing the framework
Creating pictures
Wrapping other pictures
Creating events
Binding everything together
Drawing on the canvas
Adding utility functions
Creating the models
Using enums
Storing the level
Creating the default level
Creating the state
Drawing the view
Handling events
Working with key codes
Creating the time handler
Running the game
Adding a menu
Changing the model
Rendering the menu
Handling events
Modifying the time handler
Summary
9. Playing Tic-Tac-Toe against an AI
Creating the project structure
Configure TypeScript
Adding utility functions
Creating the models
Showing the grid
Creating operations on the grid
Creating the grid
Adding tests
Random testing
Implementing the AI using Minimax
Implementing Minimax in TypeScript
Optimizing the algorithm
Creating the interface
Handling interaction
Creating players
Testing the AI
Testing with a random player
Summary
10. Migrate JavaScript to TypeScript
Gradually migrating to TypeScript
Adding TypeScript
Configuring TypeScript
Configuring the build tool
Acquiring type definitions
Testing the project
Migrating each file
Converting to ES modules
Correcting types
Adding type guards and casts
Using modern syntax
Adding types
Refactoring the project
Enable strict checks
Summary
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜