Updated Exports Files (markdown)
@@ -12,9 +12,15 @@ Exports files are processed by the `bin/generate-exports` script, using its `--e
|
||||
|
||||
Note: the `src/google.exports` file just makes the `goog.require` function be exported as a null function. This is just to be able to execute the examples both with Plovr in raw mode (`?mode=RAW`) – where `goog.require` statements are required – and against the `ol.js` build.
|
||||
|
||||
The `src/objectliterals.exports` file is specific. This file declares the config objects and properties for single-arg constructors. These declarations are done with the `@exportObjectLiteral` and `@exportObjectLiteralProperty` directives. This file is also processed with the `bin/generate-exports` script, but using the `--externs` and `--typedef` switches. The `generate-exports --externs` generates Closure externs from the `@exportObjectLiteral` and `@exportObjectLiteralProperty` directives. The `build.py` script places these externs in the `build/src/external/externs/types.js` file, which is used as a regular externs file by the Closure compiler (see `build/ol.json`). The `generate-exports --typedef` command generate typedef's for the object literals declared with `@exportObjectLiteral` and `@exportObjectLiteralProperty`. The `build.py` script places the typedef's in the `build/src/external/src/types.js`, which, like `exports.js`, is used as an input file for the ol.js build (see `build/ol.json`). Externs define types for config objects created by lib users, while typedef's define types created internally by the lib.
|
||||
The `src/objectliterals.exports` file is specific. This file declares the config objects and properties for the lib's single-arg constructors. These declarations are done with the `@exportObjectLiteral` and `@exportObjectLiteralProperty` directives. This file is also processed with the `bin/generate-exports` script, but using the `--externs` and `--typedef` switches.
|
||||
|
||||
OL3 devs need to create new exports files when adding new API elements to the lib. They also need to declare single-arg constructors' config objects and properties in `src/objectliterals.exports`.
|
||||
The `generate-exports --externs` generates Closure externs from the `@exportObjectLiteral` and `@exportObjectLiteralProperty` directives. The `build.py` script places these externs in the `build/src/external/externs/types.js` file, which is used as a regular externs file by the Closure compiler (see `build/ol.json`).
|
||||
|
||||
The `generate-exports --typedef` command generate typedef's for the object literals declared with `@exportObjectLiteral` and `@exportObjectLiteralProperty`. The `build.py` script places the typedef's in the `build/src/external/src/types.js`, which, like `exports.js`, is used as an input file for the ol.js build (see `build/ol.json`).
|
||||
|
||||
Externs define types for config objects created by lib users, while typedef's define types created internally by the lib.
|
||||
|
||||
OL3 devs and contributors need to create new exports files when adding new API elements to the lib. They also need to declare single-arg constructors' config objects and properties in `src/objectliterals.exports`.
|
||||
|
||||
## Under the hood
|
||||
|
||||
|
||||
Reference in New Issue
Block a user