Sha256: 8afe19b9310e7a3afa25ce98ad6dfea9fee929f57628557e3a85a7310ec507ed
Contents?: true
Size: 764 Bytes
Versions: 3
Compression:
Stored size: 764 Bytes
Contents
import { tracked } from '../..'; export function createTracked(values, proto = {}) { function Class() { for (let prop in values) { this[prop] = values[prop]; } } for (let prop in values) { Object.defineProperty( proto, prop, tracked(proto, prop, { enumerable: true, configurable: true, writable: true, value: values[prop], }) ); } Class.prototype = proto; return new Class(); } export function createWithDescriptors(values) { function Class() {} for (let prop in values) { let descriptor = Object.getOwnPropertyDescriptor(values, prop); Object.defineProperty(Class.prototype, prop, tracked(Class.prototype, prop, descriptor)); } return new Class(); }
Version data entries
3 entries across 3 versions & 1 rubygems