Updated Exports Files (markdown)

elemoine
2013-03-29 01:53:23 -07:00
parent 6fa0349bfd
commit 14d970a0e7
+4 -1
@@ -12,7 +12,10 @@ 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 the library's single-argument 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 `src/objectliterals.exports` file is specific. This file declares the config objects and properties for the library's single-argument 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.
Note: config objects and properties are declared in a specific file because they may be shared by multiple constructors. For example the `ol.source.Vector` constructor currently takes an `ol.source.SourceOptions` config object, and `ol.source.SourceOptions` is a generic/base type that can used for other constructors.
(We may want to change that in the future, and force each constructor to have its own config object type. In this way config objects and properties could be declared in the same exports file as their corresponding constructors.)
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`).