Skip to content

Instantly share code, notes, and snippets.

@theadam
Last active August 29, 2015 14:19
Show Gist options
  • Save theadam/1368b5b697826d97260c to your computer and use it in GitHub Desktop.
Save theadam/1368b5b697826d97260c to your computer and use it in GitHub Desktop.
class property decorators initialization
var descriptor = Object.getOwnPropertyDescriptor(Person.prototype, 'born');
if(typeof descriptor.set === 'function'){
descriptor.set(_instanceInitializers.born.call(this));
}
else if(descriptor.get === undefined && descriptor.set === undefined) {
var value = _instanceInitializers.born.call(this);
descriptor.value = value === undefined ? descriptor.value : value;
}
Object.defineProperty(this, 'born', descriptor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment