JavaScript&&标准文档注释

JavaScript&&标准文档注释

标准文档注释

/**
 * Wrapper for built-in http.js to emulate the browser XMLHttpRequest object.
 *
 * This can be used with JS designed for browsers to improve reuse of code and
 * allow the use of existing libraries.
 *
 * Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs.
 *
 * @todo SSL Support
 * @author Dan DeFelippi <[email protected]>
 * @contributor David Ellis <[email protected]>
 * @license MIT
 */

标准函数注释

示例一

  /**
     * @function getRecordings
     * @desc This function gets the all the ongoing recordings in the specified room.
     * @memberOf ICS_REST.API
     * @param {string} room                          -Room ID.
     * @param {onStreamingOutList} callback          -Callback function on success
     * @param {function} callbackError               -Callback function on error
     * @example
  var roomID = '51c10d86909ad1f939000001';
  ICS_REST.API.getRecordings(roomID, function(recordings) {
    console.log('Recordings:', recordings);
  }, function(status, error) {
    // HTTP status and error
    console.log(status, error);
  });
     */
  var getRecordings = function(room, callback, callbackError) {
    send('GET', 'rooms/' + room + '/recordings/', undefined, function(recordingList) {
      var result = JSON.parse(recordingList);
      callback(result);
    }, callbackError);
  };

  /*
     * * @callback onStartingRecordingOK
     * * @param {Object} recordingInfo               -The object containing the information of the server-side recording.
     * * @param {string} recordingInfo.id            -The recording ID.
     * * @param {Object} recordingInfo.storage       -The storage information of the recording.
     * * @param {string} recordingInfo.storage.host  -The host-name or IP address where the recording file is stored.
     * * @param {string} recordingInfo.storage.file  -The full-path name of the recording file.
     * * @param {Object} recordingInfo.media         -The media description of the recording, which must follow the definition of object "MediaSubOptions" in section "3.3.11 Participant Starts a Subscription" in "Client-Portal Protocol.md" doc.
  */

示例二

/**@namespace ICS_REST
 * @classDesc Namespace for ICS(Intel Collaboration Suite) REST API definition.
 */
/**
 * @class ICS_REST.API
 * @classDesc Server-side APIs should be called by RTC service integrators, as demostrated in sampleRTCService.js. Server-side APIs are RESTful, provided as a Node.js module. All APIs, except ICS_REST.API.init(), should not be called too frequently. These API calls carry local timestamps and are grouped by serviceID. Once the server is handling an API call from a certain serviceID, all other API calls from the same serviceID, whose timestamps are behind, would be expired or treated as invalid.<br>
We recommend that API calls against serviceID should have interval of at least 100ms. Also, it is better to retry the logic if it fails with an unexpected timestamp error.
 */
ICS_REST.API = (function(ICS_REST){...}(ICS_REST));
发布了73 篇原创文章 · 获赞 5 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/dfq737211338/article/details/104494197