Skip to content

Commit

Permalink
Merge pull request #11080 from onsummer/ts-type-enhance
Browse files Browse the repository at this point in the history
Use primitive type instead of constructor type
  • Loading branch information
jjhembd authored Feb 18, 2023
2 parents 3b93043 + 08f3886 commit 9295450
Show file tree
Hide file tree
Showing 732 changed files with 8,010 additions and 8,001 deletions.
6 changes: 3 additions & 3 deletions Apps/Sandcastle/gallery/Custom DataSource.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @alias WebGLGlobeDataSource
* @constructor
*
* @param {String} [name] The name of this data source. If undefined, a name
* @param {string} [name] The name of this data source. If undefined, a name
* will be derived from the url.
*
* @example
Expand Down Expand Up @@ -144,7 +144,7 @@
/**
* Gets the array of series names.
* @memberof WebGLGlobeDataSource.prototype
* @type {String[]}
* @type {string[]}
*/
seriesNames: {
get: function () {
Expand Down Expand Up @@ -226,7 +226,7 @@

/**
* Asynchronously loads the GeoJSON at the provided url, replacing any existing data.
* @param {Object} url The url to be processed.
* @param {object} url The url to be processed.
* @returns {Promise} a promise that will resolve when the GeoJSON is loaded.
*/
WebGLGlobeDataSource.prototype.loadUrl = function (url) {
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Custom Geocoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
/**
* The function called to geocode using this geocoder service.
*
* @param {String} input The query to be sent to the geocoder service
* @param {string} input The query to be sent to the geocoder service
* @returns {Promise<GeocoderService.Result[]>}
*/
OpenStreetMapNominatimGeocoder.prototype.geocode = function (input) {
Expand Down
3 changes: 1 addition & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

#### Major Announcements :loudspeaker:

##### Additions :tada:

##### Fixes :wrench:

- Fixed Primitive.getGeometryInstanceAttributes cache acquisition speed. [#11066](https://github.com/CesiumGS/cesium/issues/11066)
- Fixed requestWebgl1 hint error in context. [#11082](https://github.com/CesiumGS/cesium/issues/11082)
- Replace constructor types with primitive types in JSDoc. [#11080](https://github.com/CesiumGS/cesium/pull/11080)

### 1.102 - 2023-02-01

Expand Down
82 changes: 41 additions & 41 deletions Documentation/Contributors/DocumentationGuide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Consider one of the simplest functions in CesiumJS, `defined`:
* @function
*
* @param {*} value The object.
* @returns {Boolean} Returns true if the object is defined, returns false otherwise.
* @returns {boolean} Returns true if the object is defined, returns false otherwise.
*
* @example
* if (Cesium.defined(positions)) {
Expand Down Expand Up @@ -88,7 +88,7 @@ This guide describes best practices for writing doc. For complete details on JSD
- Use `[]` for optional parameters and include the default value, e.g.,

```javascript
* @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.

```

Expand Down Expand Up @@ -130,12 +130,12 @@ The CesiumJS classes in the `Type` column are links to their doc.
Each property of an `options` parameter (see the [Coding Guide](https://github.com/CesiumGS/cesium/true/main/Documentation/Contributors/CodingGuide/README.md#options-parameters)) should be documented with a separate `@param` tag, e.g.,
```javascript
* @param {Object} [options] Object with the following properties:
* @param {Number} [options.length=10000000.0] The length of the axes in meters.
* @param {Number} [options.width=2.0] The width of the axes in pixels.
* @param {object} [options] Object with the following properties:
* @param {number} [options.length=10000000.0] The length of the axes in meters.
* @param {number} [options.width=2.0] The width of the axes in pixels.
* @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The 4x4 matrix that defines the reference frame, i.e., origin plus axes, to visualize.
* @param {Boolean} [options.show=true] Determines if this primitive will be shown.
* @param {Object} [options.id] A user-defined object to return when the instance is picked with {@link Scene#pick}
* @param {boolean} [options.show=true] Determines if this primitive will be shown.
* @param {object} [options.id] A user-defined object to return when the instance is picked with {@link Scene#pick}
```
generates
Expand Down Expand Up @@ -168,7 +168,7 @@ Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, r
/**
* Computes a Matrix4 instance from a column-major order array.
*
* @param {Number[]} values The column-major order array.
* @param {number[]} values The column-major order array.
* @param {Matrix4} [result] The object in which the result will be stored. If undefined a new instance will be created.
* @returns {Matrix4} The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
Expand Down Expand Up @@ -287,53 +287,53 @@ function Cartesian3(x, y) {
/**
* The X component.
*
* @type {Number}
* @type {number}
* @default 0.0
*/
this.x = defaultValue(x, 0.0);

// ...
```
- Use `@memberOf` when documenting property getter/setters, e.g.,
- Use `@memberof` when documenting property getter/setters, e.g.,
```javascript
Object.defineProperties(Entity.prototype, {
/**
* Gets or sets whether this entity should be displayed. When set to true,
* the entity is only displayed if the parent entity's show property is also true.
*
* @memberof Entity.prototype
* @type {Boolean}
*/
show : {
get : function() {
// ...
},
set : function(value) {
// ...
}
/**
* Gets or sets whether this entity should be displayed. When set to true,
* the entity is only displayed if the parent entity's show property is also true.
*
* @memberof Entity.prototype
* @type {boolean}
*/
show: {
get: function() {
// ...
},
set: function(value) {
// ...
}
},
// ...
```
- Use `@readonly` to indicate read-only properties, e.g.,
```javascript
Object.defineProperties(Entity.prototype, {
/**
* Gets the unique ID associated with this object.
*
* @memberof Entity.prototype
* @type {String}
* @readonly
*/
id : {
get : function() {
return this._id;
}
},
// ...
/**
* Gets the unique ID associated with this object.
*
* @memberof Entity.prototype
* @type {string}
* @readonly
*/
id: {
get: function() {
return this._id;
}
},
// ...
```
- The description for readonly properties should start with "Gets", and the description for read/write properties should start with "Gets or sets."
Expand All @@ -358,8 +358,8 @@ Cartesian3.ZERO = Object.freeze(new Cartesian3(0.0, 0.0, 0.0));
* Creates a Cartesian4 from four consecutive elements in an array.
* @function
*
* @param {Number[]} array The array whose four consecutive elements correspond to the x, y, z, and w components, respectively.
* @param {Number} [startingIndex=0] The offset into the array of the first element, which corresponds to the x component.
* @param {number[]} array The array whose four consecutive elements correspond to the x, y, z, and w components, respectively.
* @param {number} [startingIndex=0] The offset into the array of the first element, which corresponds to the x component.
* @param {Cartesian4} [result] The object on which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
Expand Down Expand Up @@ -399,13 +399,13 @@ Queue.prototype.sort = function (compareFunction) {
*
* @param {*} a An item in the array.
* @param {*} b An item in the array.
* @returns {Number} Returns a negative value if <code>a</code> is less than <code>b</code>,
* @returns {number} Returns a negative value if <code>a</code> is less than <code>b</code>,
* a positive value if <code>a</code> is greater than <code>b</code>, or
* 0 if <code>a</code> is equal to <code>b</code>.
*
* @example
* function compareNumbers(a, b) {
* return a - b;
* return a - b;
* }
*/
```
Expand Down
26 changes: 13 additions & 13 deletions Specs/ImplicitTilingTester.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ function ImplicitTilingTester() {}

/**
* Description of a single availability bitstream
* @typedef {Object} AvailabilityDescription
* @property {String|Number} descriptor Either a string of <code>0</code>s and <code>1</code>s representing the bitstream values, or an integer <code>0</code> or <code>1</code> to indicate a constant value.
* @property {Number} lengthBits How many bits are in the bitstream. This must be specified, even if descriptor is a string of <code>0</code>s and <code>1</code>s
* @property {Boolean} isInternal <code>true</code> if an internal bufferView should be created. <code>false</code> indicates the bufferview is stored in an external buffer instead.
* @property {Boolean} [shareBuffer=false] This is only used for content availability. If <code>true</code>, then the content availability will share the same buffer as the tile availaibility, as this is a common optimization
* @property {Boolean} [includeAvailableCount=false] If true, set availableCount
* @typedef {object} AvailabilityDescription
* @property {string|number} descriptor Either a string of <code>0</code>s and <code>1</code>s representing the bitstream values, or an integer <code>0</code> or <code>1</code> to indicate a constant value.
* @property {number} lengthBits How many bits are in the bitstream. This must be specified, even if descriptor is a string of <code>0</code>s and <code>1</code>s
* @property {boolean} isInternal <code>true</code> if an internal bufferView should be created. <code>false</code> indicates the bufferview is stored in an external buffer instead.
* @property {boolean} [shareBuffer=false] This is only used for content availability. If <code>true</code>, then the content availability will share the same buffer as the tile availaibility, as this is a common optimization
* @property {boolean} [includeAvailableCount=false] If true, set availableCount
*/

/**
* A description of metadata properties stored in the subtree.
* @typedef {Object} MetadataDescription
* @property {Boolean} isInternal True if the metadata should be stored in the subtree file, false if the metadata should be stored in an external buffer.
* @typedef {object} MetadataDescription
* @property {boolean} isInternal True if the metadata should be stored in the subtree file, false if the metadata should be stored in an external buffer.
* @property {Array} propertyTables Array of property table objects to pass into {@link MetadataTester.createPropertyTables} in order to create the property table buffer views.
* @private
*/

/**
* A JSON description of a subtree file for easier generation
* @typedef {Object} SubtreeDescription
* @property {Boolean} [useLegacySchema=false] If true, the resulting JSON chunk will use the legacy schema for subtrees and metadata (e.g. use bufferViews rather than bitstream, use 3DTILES_metadata extension rather than tileMetadata or contentMetadata, use 3DTILES_multiple_contents extension rather than contents). Used to test backwards compatibility.
* @typedef {object} SubtreeDescription
* @property {boolean} [useLegacySchema=false] If true, the resulting JSON chunk will use the legacy schema for subtrees and metadata (e.g. use bufferViews rather than bitstream, use 3DTILES_metadata extension rather than tileMetadata or contentMetadata, use 3DTILES_multiple_contents extension rather than contents). Used to test backwards compatibility.
* @property {AvailabilityDescription} tileAvailability A description of the tile availability bitstream to generate
* @property {AvailabilityDescription} contentAvailability A description of the content availability bitstream to generate
* @property {AvailabilityDescription} childSubtreeAvailability A description of the child subtree availability bitstream to generate
* @property {AvailabilityDescription} other A description of another bitstream. This is not used for availability, but rather to simulate extra buffer views.
* @property {MetadataDescription} [metadata] For testing metadata, additional options can be passed in here.
* @property {Boolean} [json] If true, return the result as a JSON with external buffers. Should not be true if any of the availability buffers are internal.
* @property {boolean} [json] If true, return the result as a JSON with external buffers. Should not be true if any of the availability buffers are internal.
* @private
*/

/**
* Results of procedurally generating a subtree.
* @typedef {Object} GeneratedSubtree
* @typedef {object} GeneratedSubtree
* @property {Uint8Array} [subtreeJson] The JSON portion of the subtree file. Mutually exclusive with subtreeBuffer.
* @property {Uint8Array} [subtreeBuffer] A typed array storing the contents of the subtree file (including the internal buffer). Mutually exclusive with subtreeJson.
* @property {Uint8Array} externalBuffer A typed array representing an external .bin file. This is always returned, but it may be an empty typed array.
Expand All @@ -51,7 +51,7 @@ function ImplicitTilingTester() {}
/**
* Generate a subtree buffer
* @param {SubtreeDescription} subtreeDescription A JSON description of the subtree's structure and values
* @param {Boolean} constantOnly true if all the bitstreams are constant, i.e. no buffers/bufferViews are needed.
* @param {boolean} constantOnly true if all the bitstreams are constant, i.e. no buffers/bufferViews are needed.
* @return {GeneratedSubtree} The procedurally generated subtree and an external buffer.
*
* @example
Expand Down
Loading

0 comments on commit 9295450

Please sign in to comment.