Improvements to externs readme

This commit is contained in:
Peter Robins
2014-05-29 11:21:42 +01:00
parent b6e0195c9b
commit 8dc3b95194

View File

@@ -8,7 +8,7 @@ These two files are special externs that belong to ol3, and this document explai
### Prevent class properties from being renamed
For events, we make properties available to the application. Other than methods, which can be made available by just marking them with the `@api` annotation directly where they are defined, properties need to be added to `oli.js` in addition:
For events, we make properties available to the application. Methods can be made available by just marking them with the `@api` annotation directly where they are defined; properties should also be added to `oli.js`:
```js
/** @interface */
@@ -43,7 +43,7 @@ ol.MapBrowserEvent = function(type, map, browserEvent, opt_frameState) {
### Override methods in custom classes
For custom subclasses in applications, which can be created using `ol.extends`, the API may want to make certain methods available to override. In addition to marking such methods as `@api`, they need also be added to an interface in `oli.js`:
For custom subclasses in applications, which can be created using `ol.inherits`, the API may want to make certain methods available to override. In addition to marking such methods as `@api`, they should also be added to an interface in `oli.js`:
```js
/**
* @interface
@@ -79,6 +79,7 @@ ol.control.Control.prototype.setMap = function(map) {
// ...
};
```
See Custom controls example for an example of how this can be used.
### Export object literals