cloudfunctions/SegmentPortraitPic/node_modules/protobufjs/src/service.js
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
"use strict";
module.exports = Service;
// extends Namespace
var Namespace = require("./namespace");
((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service";
var Method = require("./method"),
util = require("./util"),
rpc = require("./rpc");
/**
* Constructs a new service instance.
* @classdesc Reflected service.
* @extends NamespaceBase
* @constructor
* @param {string} name Service name
* @param {Object.<string,*>} [options] Service options
* @throws {TypeError} If arguments are invalid
*/
function Service(name, options) {
Namespace.call(this, name, options);
/**
* Service methods.
* @type {Object.<string,Method>}
*/
this.methods = {}; // toJSON, marker
/**
* Cached methods as an array.
* @type {Method[]|null}
* @private
*/
this._methodsArray = null;
}
/**
* Service descriptor.
* @interface IService
* @extends INamespace
* @property {Object.<string,IMethod>} methods Method descriptors
*/
/**
* Constructs a service from a service descriptor.
* @param {string} name Service name
* @param {IService} json Service descriptor
* @returns {Service} Created service
* @throws {TypeError} If arguments are invalid
*/
Service.fromJSON = function fromJSON(name, json) {
var service = new Service(name, json.options);
/* istanbul ignore else */
if (json.methods)
for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i)
service.add(Method.fromJSON(names[i], json.methods[names[i]]));
if (json.nested)
service.addJSON(json.nested);
service.comment = json.comment;
后面还有 107 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
