Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make object default values available via its prototype #10

Open
nikku opened this issue Jul 30, 2015 · 0 comments
Open

Make object default values available via its prototype #10

nikku opened this issue Jul 30, 2015 · 0 comments
Labels
backlog Queued in backlog enhancement New feature or request

Comments

@nikku
Copy link
Member

nikku commented Jul 30, 2015

We should have a general solution that allows us to model default values.

This should fix issues addressed in #9 and allow a consistent access to default values from javascript and during serialization.

Example

var foo = moddle.create('foo');

// accessing default value via prototype
foo.someValueWithDefault; // 'BAR'
foo.hasOwnProperty('someValueWithDefault'); // false

// accessing actual value
foo.someValueWithDefault = 'FOOBAR';
foo.hasOwnProperty('someValueWithDefault'); // true

// removing actual value
delete foo.someValueWithDefault;

Notes

  • Some values such as collection properties must not be removable and cannot be provided via the prototype either
@nikku nikku added the enhancement New feature or request label Jul 30, 2015
@nikku nikku added the backlog Queued in backlog label Feb 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant