Skip to content

Instantly share code, notes, and snippets.

@slorber
Created July 10, 2014 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slorber/345c139e0b4624029e8a to your computer and use it in GitHub Desktop.
Save slorber/345c139e0b4624029e8a to your computer and use it in GitHub Desktop.
var AppState = function() { };
AppState.prototype = {
updateAppState: function(updateFunction) {
console.debug("before updating:",this);
console.debug("before updating:",this.constructor);
console.debug("before updating:",new this.constructor());
console.debug("before updating:",new this.prototype.constructor());
Preconditions.checkMandatoryParameter(updateFunction,"updateFunction is required");
var updated = React.addons.update(this, updateFunction);
//DeepFreeze(updated);
return updated;
},
}
This gives me the following when I call "new AppState().updateAppState(...)"
before updating:
AppState {updateAppState: function, initialAppState: function, updateUserData: function, removeUserData: function, updateSelectedPane: function…}
appState.js:17
before updating: function Object() { [native code] } appState.js:18
before updating: Object {} appState.js:19
Uncaught TypeError: Cannot read property 'constructor' of undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment