Updated Exports Files (markdown)
+14
@@ -60,6 +60,20 @@ The `generate-exports --typedef` command generate typedef's for the object liter
|
|||||||
|
|
||||||
Externs define types for options objects created by library's users, while typedef's define types created internally by the library.
|
Externs define types for options objects created by library's users, while typedef's define types created internally by the library.
|
||||||
|
|
||||||
|
## The oli.js externs file
|
||||||
|
|
||||||
|
The `externs/oli.js` file defines externs for functions that may be defined in application code and called by the library. For the library to be able to call user-defined functions, these functions should not be renamed within the library.
|
||||||
|
|
||||||
|
For example, `oli.js` includes the following definition:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ol.Map} map Map.
|
||||||
|
* @return {undefined} Undefined.
|
||||||
|
*/
|
||||||
|
oli.control.Control.prototype.setMap = function(map) {};
|
||||||
|
|
||||||
|
This will prevent the Compiler from renaming `setMap` internally, allowing the creation of custom controls defining their own `setMap` functions. (The `ol.control.Control.prototype.setMap` function is also exported, making it possible to call it from child implementations.)
|
||||||
|
|
||||||
## Under the hood
|
## Under the hood
|
||||||
|
|
||||||
`build/src/internal/src/requireall.js` is used in the `build.py build-all` target to ensure that all source files are passed to the compiler.
|
`build/src/internal/src/requireall.js` is used in the `build.py build-all` target to ensure that all source files are passed to the compiler.
|
||||||
|
|||||||
Reference in New Issue
Block a user