diff --git a/src/ParseObject.js b/src/ParseObject.js index eb090ac07..4d7655140 100644 --- a/src/ParseObject.js +++ b/src/ParseObject.js @@ -99,6 +99,11 @@ export default class ParseObject { className: string; constructor(className: ?string | { className: string, [attr: string]: mixed }, attributes?: { [attr: string]: mixed }, options?: { ignoreValidation: boolean }) { + // Enable legacy initializers + if (typeof this.initialize === 'function') { + this.initialize.apply(this, arguments); + } + var toSet = null; this._objCount = objectCount++; if (typeof className === 'string') { @@ -121,10 +126,6 @@ export default class ParseObject { if (toSet && !this.set(toSet, options)) { throw new Error('Can\'t create an invalid Parse Object'); } - // Enable legacy initializers - if (typeof this.initialize === 'function') { - this.initialize.apply(this, arguments); - } } /** Prototype getters / setters **/ @@ -1366,6 +1367,11 @@ export default class ParseObject { parentProto = classMap[adjustedClassName].prototype; } var ParseObjectSubclass = function(attributes, options) { + // Enable legacy initializers + if (typeof this.initialize === 'function') { + this.initialize.apply(this, arguments); + } + this.className = adjustedClassName; this._objCount = objectCount++; if (attributes && typeof attributes === 'object'){ @@ -1373,10 +1379,6 @@ export default class ParseObject { throw new Error('Can\'t create an invalid Parse Object'); } } - // Enable legacy initializers - if (typeof this.initialize === 'function') { - this.initialize.apply(this, arguments); - } }; ParseObjectSubclass.className = adjustedClassName; ParseObjectSubclass.__super__ = parentProto;