Created
December 9, 2014 23:50
-
-
Save stephen/4d8f3ce04fb2a2d5f389 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static createProxyFromModel(model) { | |
return new Proxy(model, { | |
get: function(target, name) { | |
if (name in model.definition) { | |
return model.get(name); | |
} else { | |
return target[name]; | |
} | |
}, | |
set: function(target, name, value) { | |
if (name in model.definition) { | |
model.set(name, value); | |
} else { | |
target[name] = value; | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment