Merge pull request #3871 from ahocevar/change-event

Document change events properly
This commit is contained in:
Andreas Hocevar
2015-07-18 15:41:05 +02:00
8 changed files with 32 additions and 16 deletions
+9 -9
View File
@@ -24,7 +24,7 @@ var self = this;
<?js } ?> <?js } ?>
</dt> </dt>
<dd class="<?js= (data.stability && data.stability !== 'stable') ? 'unstable' : '' ?>"> <dd class="<?js= (data.stability && data.stability !== 'stable') ? 'unstable' : '' ?>">
<?js if (data.description) { ?> <?js if (data.description) { ?>
<div class="description"> <div class="description">
<?js= data.description ?> <?js= data.description ?>
@@ -39,20 +39,20 @@ var self = this;
</li> </li>
</ul> </ul>
<?js } ?> <?js } ?>
<?js if (data['this']) { ?> <?js if (data['this']) { ?>
<h5>This:</h5> <h5>This:</h5>
<ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul> <ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul>
<?js } ?> <?js } ?>
<?js if (data.stability || kind !== 'class') { ?> <?js if (data.stability || kind !== 'class') { ?>
<?js if (data.params && params.length) { ?> <?js if (data.params && params.length) { ?>
<?js= this.partial('params.tmpl', params) ?> <?js= this.partial('params.tmpl', params) ?>
<?js } ?> <?js } ?>
<?js } ?> <?js } ?>
<?js= this.partial('details.tmpl', data) ?> <?js= this.partial('details.tmpl', data) ?>
<?js if (data.fires && fires.length) { ?> <?js if (data.fires && fires.length) { ?>
<h5>Fires:</h5> <h5>Fires:</h5>
<ul><?js fires.forEach(function(f) { <ul><?js fires.forEach(function(f) {
@@ -68,7 +68,7 @@ var self = this;
} }
?> ?>
<li class="<?js= (eventDoclet || data).stability !== 'stable' ? 'unstable' : '' ?>"> <li class="<?js= (eventDoclet || data).stability !== 'stable' ? 'unstable' : '' ?>">
<code><?js= self.linkto(f, type) ?></code> <code><?js= eventClassName ? self.linkto(f, type) : type ?></code>
<?js if (eventClassName) { <?js if (eventClassName) {
var eventClass = self.find({longname: eventClassName})[0]; var eventClass = self.find({longname: eventClassName})[0];
if (eventClass) { ?> if (eventClass) { ?>
@@ -96,7 +96,7 @@ var self = this;
<li><?js= self.linkto(f) ?></li> <li><?js= self.linkto(f) ?></li>
<?js }); ?></ul> <?js }); ?></ul>
<?js } ?> <?js } ?>
<?js if (data.exceptions && exceptions.length) { ?> <?js if (data.exceptions && exceptions.length) { ?>
<h5>Throws:</h5> <h5>Throws:</h5>
<?js if (exceptions.length > 1) { ?><ul><?js <?js if (exceptions.length > 1) { ?><ul><?js
@@ -108,12 +108,12 @@ var self = this;
<?js= self.partial('exceptions.tmpl', r) ?> <?js= self.partial('exceptions.tmpl', r) ?>
<?js }); <?js });
} } ?> } } ?>
<?js if (data.returns && returns.length) { ?> <?js if (data.returns && returns.length) { ?>
<?js if (returns.length > 1) { ?><h5>Returns:</h5><?js } ?> <?js if (returns.length > 1) { ?><h5>Returns:</h5><?js } ?>
<?js= self.partial('returns.tmpl', data.returns) ?> <?js= self.partial('returns.tmpl', data.returns) ?>
<?js } ?> <?js } ?>
<?js if (data.examples && examples.length) { ?> <?js if (data.examples && examples.length) { ?>
<h5>Example<?js= examples.length > 1? 's':'' ?></h5> <h5>Example<?js= examples.length > 1? 's':'' ?></h5>
<?js= this.partial('examples.tmpl', examples) ?> <?js= this.partial('examples.tmpl', examples) ?>
+3 -1
View File
@@ -67,9 +67,11 @@ ol.DeviceOrientationProperty = {
* *
* @see http://www.w3.org/TR/orientation-event/ * @see http://www.w3.org/TR/orientation-event/
* *
* To get notified of device orientation changes, register a listener for the
* generic `change` event on your `ol.DeviceOrientation` instance.
*
* @constructor * @constructor
* @extends {ol.Object} * @extends {ol.Object}
* @fires change Triggered when the device orientation changes.
* @param {olx.DeviceOrientationOptions=} opt_options Options. * @param {olx.DeviceOrientationOptions=} opt_options Options.
* @api * @api
*/ */
+3 -1
View File
@@ -39,6 +39,9 @@ ol.GeolocationProperty = {
* The [Geolocation API](http://www.w3.org/TR/geolocation-API/) * The [Geolocation API](http://www.w3.org/TR/geolocation-API/)
* is used to locate a user's position. * is used to locate a user's position.
* *
* To get notified of position changes, register a listener for the generic
* `change` event on your instance of `ol.Geolocation`.
*
* Example: * Example:
* *
* var geolocation = new ol.Geolocation({ * var geolocation = new ol.Geolocation({
@@ -52,7 +55,6 @@ ol.GeolocationProperty = {
* *
* @constructor * @constructor
* @extends {ol.Object} * @extends {ol.Object}
* @fires change Triggered when the position changes.
* @param {olx.GeolocationOptions=} opt_options Options. * @param {olx.GeolocationOptions=} opt_options Options.
* @api stable * @api stable
*/ */
+3 -1
View File
@@ -50,9 +50,11 @@ ol.geom.GeometryLayout = {
* instantiated in apps. * instantiated in apps.
* Base class for vector geometries. * Base class for vector geometries.
* *
* To get notified of changes to the geometry, register a listener for the
* generic `change` event on your geometry instance.
*
* @constructor * @constructor
* @extends {ol.Object} * @extends {ol.Object}
* @fires change Triggered when the geometry changes.
* @api stable * @api stable
*/ */
ol.geom.Geometry = function() { ol.geom.Geometry = function() {
+2 -1
View File
@@ -19,10 +19,11 @@ goog.require('ol.source.State');
* Layers group together those properties that pertain to how the data is to be * Layers group together those properties that pertain to how the data is to be
* displayed, irrespective of the source of that data. * displayed, irrespective of the source of that data.
* *
* A generic `change` event is fired when the state of the source changes.
*
* @constructor * @constructor
* @extends {ol.layer.Base} * @extends {ol.layer.Base}
* @fires ol.render.Event * @fires ol.render.Event
* @fires change Triggered when the state of the source changes.
* @param {olx.layer.LayerOptions} options Layer options. * @param {olx.layer.LayerOptions} options Layer options.
* @api stable * @api stable
*/ */
+2 -1
View File
@@ -29,9 +29,10 @@ ol.layer.GroupProperty = {
* @classdesc * @classdesc
* A {@link ol.Collection} of layers that are handled together. * A {@link ol.Collection} of layers that are handled together.
* *
* A generic `change` event is triggered when the group/Collection changes.
*
* @constructor * @constructor
* @extends {ol.layer.Base} * @extends {ol.layer.Base}
* @fires change Triggered when the group/Collection changes.
* @param {olx.layer.GroupOptions=} opt_options Layer options. * @param {olx.layer.GroupOptions=} opt_options Layer options.
* @api stable * @api stable
*/ */
+8 -1
View File
@@ -16,6 +16,7 @@ goog.require('goog.events.EventType');
* *
* @constructor * @constructor
* @extends {goog.events.EventTarget} * @extends {goog.events.EventTarget}
* @fires change
* @suppress {checkStructDictInheritance} * @suppress {checkStructDictInheritance}
* @struct * @struct
* @api stable * @api stable
@@ -46,7 +47,6 @@ ol.Observable.unByKey = function(key) {
/** /**
* Increases the revision counter and dispatches a 'change' event. * Increases the revision counter and dispatches a 'change' event.
* @fires change
* @api * @api
*/ */
ol.Observable.prototype.changed = function() { ol.Observable.prototype.changed = function() {
@@ -55,6 +55,13 @@ ol.Observable.prototype.changed = function() {
}; };
/**
* Triggered when the revision counter is increased.
* @event change
* @api
*/
/** /**
* @return {number} Revision. * @return {number} Revision.
* @api * @api
+2 -1
View File
@@ -37,9 +37,10 @@ ol.source.SourceOptions;
* instantiated in apps. * instantiated in apps.
* Base class for {@link ol.layer.Layer} sources. * Base class for {@link ol.layer.Layer} sources.
* *
* A generic `change` event is triggered when the state of the source changes.
*
* @constructor * @constructor
* @extends {ol.Object} * @extends {ol.Object}
* @fires change Triggered when the state of the source changes.
* @param {ol.source.SourceOptions} options Source options. * @param {ol.source.SourceOptions} options Source options.
* @api stable * @api stable
*/ */