• Haxe Manual
  • Introduction
  • 1. Introduction
    • 1.1. What is Haxe?
    • 1.2. About this Document
      • 1.2.1. Authors and contributions
      • 1.2.2. License
    • 1.3. Hello World
    • 1.4. History
  • 2. Types
    • 2.1. Basic Types
      • 2.1.1. Numeric types
      • 2.1.2. Overflow
      • 2.1.3. Numeric Operators
      • 2.1.4. Bool
      • 2.1.5. Void
    • 2.2. Nullability
      • 2.2.1. Optional Arguments and Nullability
    • 2.3. Class Instance
      • 2.3.1. Class constructor
      • 2.3.2. Inheritance
      • 2.3.3. Interfaces
    • 2.4. Enum Instance
      • 2.4.1. Enum Constructor
      • 2.4.2. Using enums
    • 2.5. Anonymous Structure
      • 2.5.1. JSON for Structure Values
      • 2.5.2. Class Notation for Structure Types
      • 2.5.3. Optional Fields
      • 2.5.4. Impact on Performance
    • 2.6. Function Type
      • 2.6.1. Optional Arguments
      • 2.6.2. Default values
    • 2.7. Dynamic
      • 2.7.1. Dynamic with Type Parameter
      • 2.7.2. Implementing Dynamic
    • 2.8. Abstract
      • 2.8.1. Implicit Casts
      • 2.8.2. Operator Overloading
      • 2.8.3. Array Access
      • 2.8.4. Selective Functions
      • 2.8.5. Enum abstracts
      • 2.8.6. Forwarding abstract fields
      • 2.8.7. Core-type abstracts
    • 2.9. Monomorph
  • 3. Type System
    • 3.1. Typedef
      • 3.1.1. Extensions
    • 3.2. Type Parameters
      • 3.2.1. Constraints
    • 3.3. Generic
      • 3.3.1. Construction of generic type parameters
    • 3.4. Variance
    • 3.5. Unification
      • 3.5.1. Between Class/Interface
      • 3.5.2. Structural Subtyping
      • 3.5.3. Monomorphs
      • 3.5.4. Function Return
      • 3.5.5. Common Base Type
    • 3.6. Type Inference
      • 3.6.1. Top-down Inference
      • 3.6.2. Limitations
    • 3.7. Modules and Paths
      • 3.7.1. Module Sub-Types
      • 3.7.2. Import
      • 3.7.3. Resolution Order
  • 4. Class Fields
    • 4.1. Variable
    • 4.2. Property
      • 4.2.1. Common accessor identifier combinations
      • 4.2.2. Impact on the type system
      • 4.2.3. Rules for getter and setter
    • 4.3. Method
      • 4.3.1. Overriding Methods
      • 4.3.2. Effects of variance and access modifiers
    • 4.4. Access Modifier
      • 4.4.1. Visibility
      • 4.4.2. Inline
      • 4.4.3. Dynamic
      • 4.4.4. Override
  • 5. Expressions
    • 5.1. Blocks
    • 5.2. Constants
    • 5.3. Binary Operators
    • 5.4. Unary Operators
    • 5.5. Array Declaration
    • 5.6. Object Declaration
    • 5.7. Field Access
    • 5.8. Array Access
    • 5.9. Function Call
    • 5.10. var
    • 5.11. Local functions
    • 5.12. new
    • 5.13. for
    • 5.14. while
    • 5.15. do-while
    • 5.16. if
    • 5.17. switch
    • 5.18. try/catch
    • 5.19. return
    • 5.20. break
    • 5.21. continue
    • 5.22. throw
    • 5.23. cast
      • 5.23.1. unsafe cast
      • 5.23.2. safe cast
    • 5.24. type check
  • 6. Language Features
    • 6.1. Conditional Compilation
      • 6.1.1. Global Compiler Flags
    • 6.2. Externs
    • 6.3. Static Extension
      • 6.3.1. In the Haxe Standard Library
    • 6.4. Pattern Matching
      • 6.4.1. Introduction
      • 6.4.2. Enum matching
      • 6.4.3. Variable capture
      • 6.4.4. Structure matching
      • 6.4.5. Array matching
      • 6.4.6. Or patterns
      • 6.4.7. Guards
      • 6.4.8. Match on multiple values
      • 6.4.9. Extractors
      • 6.4.10. Exhaustiveness checks
      • 6.4.11. Useless pattern checks
    • 6.5. String Interpolation
    • 6.6. Array Comprehension
    • 6.7. Iterators
    • 6.8. Function Bindings
    • 6.9. Metadata
    • 6.10. Access Control
    • 6.11. Inline constructors
  • 7. Compiler Usage
  • 8. Compiler Features
    • 8.1. Built-in Compiler Metadata
    • 8.2. Dead Code Elimination
    • 8.3. Compiler Services
      • 8.3.1. Overview
      • 8.3.2. Field access completion
      • 8.3.3. Call argument completion
      • 8.3.4. Type path completion
      • 8.3.5. Usage completion
      • 8.3.6. Position completion
      • 8.3.7. Top-level completion
      • 8.3.8. Completion server
    • 8.4. Resources
      • 8.4.1. Embedding resources
      • 8.4.2. Retrieving text resources
      • 8.4.3. Retrieving binary resources
      • 8.4.4. Implementation details
    • 8.5. Runtime Type Information
      • 8.5.1. RTTI structure
  • 9. Macros
    • 9.1. Macro Context
    • 9.2. Arguments
      • 9.2.1. ExprOf
      • 9.2.2. Constant Expressions
      • 9.2.3. Rest Argument
    • 9.3. Reification
      • 9.3.1. Expression Reification
      • 9.3.2. Type Reification
      • 9.3.3. Class Reification
    • 9.4. Tools
    • 9.5. Type Building
      • 9.5.1. Enum building
      • 9.5.2. @:autoBuild
      • 9.5.3. @:genericBuild
    • 9.6. Limitations
      • 9.6.1. Macro-in-Macro
      • 9.6.2. Static extension
      • 9.6.3. Build Order
      • 9.6.4. Type Parameters
    • 9.7. Initialization macros
  • 10. Standard Library
    • 10.1. String
    • 10.2. Data Structures
      • 10.2.1. Array
      • 10.2.2. Vector
      • 10.2.3. List
      • 10.2.4. GenericStack
      • 10.2.5. Map
      • 10.2.6. Option
    • 10.3. Regular Expressions
      • 10.3.1. Matching
      • 10.3.2. Groups
      • 10.3.3. Replace
      • 10.3.4. Split
      • 10.3.5. Map
      • 10.3.6. Implementation Details
    • 10.4. Math
      • 10.4.1. Special Numbers
      • 10.4.2. Mathematical Errors
      • 10.4.3. Integer Math
      • 10.4.4. Extensions
    • 10.5. Lambda
    • 10.6. Template
    • 10.7. Reflection
    • 10.8. Serialization
      • 10.8.1. Serialization format
    • 10.9. Xml
      • 10.9.1. Getting started with Xml
      • 10.9.2. Parsing Xml
      • 10.9.3. Encoding Xml
    • 10.10. Json
      • 10.10.1. Parsing JSON
      • 10.10.2. Encoding JSON
      • 10.10.3. Implementation details
    • 10.11. Input/Output
    • 10.12. Sys/sys
    • 10.13. Remoting
      • 10.13.1. Remoting Connection
      • 10.13.2. Implementation details
    • 10.14. Unit testing
  • 11. Haxelib
    • 11.1. Using a Haxe library with the Haxe Compiler
    • 11.2. haxelib.json
      • 11.2.1. Versioning
      • 11.2.2. Dependencies
    • 11.3. extraParams.hxml
    • 11.4. Using Haxelib
  • 12. Target Details
    • 12.1. JavaScript
      • 12.1.1. Getting started with Haxe/JavaScript
      • 12.1.2. Using external JavaScript libraries
      • 12.1.3. Inject raw JavaScript
      • 12.1.4. JavaScript untyped functions
      • 12.1.5. Debugging JavaScript
      • 12.1.6. JavaScript target Metadata
      • 12.1.7. Exposing Haxe classes for JavaScript
      • 12.1.8. Loading extern classes using "require" function
    • 12.2. Flash
      • 12.2.1. Getting started with Haxe/Flash
      • 12.2.2. Embedding resources
      • 12.2.3. Using external Flash libraries
      • 12.2.4. Flash target Metadata
    • 12.3. Neko
    • 12.4. PHP
      • 12.4.1. Getting started with Haxe/PHP
      • 12.4.2. PHP untyped functions
    • 12.5. C++
      • 12.5.1. Using C++ Defines
      • 12.5.2. Using C++ Pointers
    • 12.6. Java
    • 12.7. C#
    • 12.8. Python
Powered by GitBook

Haxe Manual

12.1 JavaScript

12.1.1: Getting started with Haxe/JavaScript

12.1.2: Using external JavaScript libraries

12.1.3: Inject raw JavaScript

12.1.4: JavaScript untyped functions

12.1.5: Debugging JavaScript

12.1.6: JavaScript target Metadata

12.1.7: Exposing Haxe classes for JavaScript

12.1.8: Loading extern classes using "require" function