From ad2999fad119c3dfc1ec4c33e80845a20870e9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Fri, 10 May 2013 04:45:16 -0700 Subject: [PATCH] Updated Exports Files (markdown) --- Exports-Files.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Exports-Files.md b/Exports-Files.md index ecbc0aa..5c5ec53 100644 --- a/Exports-Files.md +++ b/Exports-Files.md @@ -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. +## 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 `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.