Skip to content

Commit

Permalink
fix(ProxyManager): Extend configuration options
Browse files Browse the repository at this point in the history
Add support for setting property once the instance is created
  • Loading branch information
jourdain committed Jan 25, 2018
1 parent 9cd8eef commit d47776e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Sources/Proxy/Core/ProxyManager/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,25 @@ export default function addRegistrationAPI(publicAPI, model) {
proxyManager: publicAPI,
})
);

// Handle property setting
if (definition.props) {
proxy.set(definition.props);
}

// Handle proxy property settings
if (definition.proxyProps) {
const proxyMap = {};
Object.keys(definition.proxyProps).forEach((key) => {
const newProxyDef = definition.proxyProps[key];
proxyMap[key] = publicAPI.createProxy(
newProxyDef.group,
newProxyDef.name,
newProxyDef.options
);
});
proxy.set(proxyMap);
}
registerProxy(proxy);

// Automatically make it active if possible
Expand Down

0 comments on commit d47776e

Please sign in to comment.