UNPKG

homey-api

Version:
47 lines (39 loc) 796 B
'use strict'; /** * @private * @class */ class APIDefinition { /** * * @param {object} opts * @param {import('./API.js')} opts.api * @param {object} opts.properties */ constructor({ api = null, properties = {}, }) { Object.defineProperty(this, '__api', { value: api, enumerable: false, writable: false, }); Object.defineProperty(this, '__properties', { value: properties, enumerable: false, writable: false, }); for (const key of Object.keys(properties)) { if (typeof this[key] !== 'undefined') continue; this[key] = properties[key]; } } __makeClass(Class, properties) { return new Class({ properties, api: this.__api, }); } } module.exports = APIDefinition;