Add deprecation notes for ol.Attribution

This commit is contained in:
Tim Schaub
2017-10-08 15:07:09 -06:00
parent 2dd8fdb5b7
commit b94b8cc40d
3 changed files with 32 additions and 0 deletions

View File

@@ -2,6 +2,36 @@
### Next Release ### Next Release
#### Deprecation of `ol.Attribution`
`ol.Attribution` is deprecated and will be removed in the next major version. Instead, you can construct a source with a string attribution or an array of strings. For dynamic attributions, you can provide a function that gets called with the current frame state.
Before:
```js
var source = new ol.source.XYZ({
attributions: [
new ol.Attribution({html: 'some attribution'})
]
});
```
After:
```js
var source = new ol.source.XYZ({
attributions: 'some attribution'
});
```
In addition to passing a string or an array of strings for the `attributions` option, you can also pass a function that will get called with the current frame state.
```js
var source = new ol.source.XYZ({
attributions: function(frameState) {
// inspect the frame state and return attributions
return 'some attribution'; // or ['multiple', 'attributions'] or null
}
});
```
### v4.4.0 ### v4.4.0
#### Behavior change for polygon labels #### Behavior change for polygon labels

View File

@@ -22,6 +22,7 @@ goog.require('ol.tilegrid');
* .. * ..
* *
* @constructor * @constructor
* @deprecated This class is deprecated and will removed in the next major release.
* @param {olx.AttributionOptions} options Attribution options. * @param {olx.AttributionOptions} options Attribution options.
* @struct * @struct
* @api * @api

View File

@@ -67,6 +67,7 @@ ol.inherits(ol.source.Source, ol.Object);
/** /**
* Turns the attributions option into an attributions function. * Turns the attributions option into an attributions function.
* @suppress {deprecated}
* @param {ol.AttributionLike|undefined} attributionLike The attribution option. * @param {ol.AttributionLike|undefined} attributionLike The attribution option.
* @return {?ol.Attribution2} An attribution function (or null). * @return {?ol.Attribution2} An attribution function (or null).
*/ */