{"action":"created","issue":{"url":"https://api.github.com/repos/skatejs/skatejs/issues/281","labels_url":"https://api.github.com/repos/skatejs/skatejs/issues/281/labels{/name}","comments_url":"https://api.github.com/repos/skatejs/skatejs/issues/281/comments","events_url":"https://api.github.com/repos/skatejs/skatejs/issues/281/events","html_url":"https://github.com/skatejs/skatejs/issues/281","id":101113861,"number":281,"title":"Finalise property options","user":{"login":"treshugart","id":136556,"avatar_url":"https://avatars.githubusercontent.com/u/136556?v=3","gravatar_id":"","url":"https://api.github.com/users/treshugart","html_url":"https://github.com/treshugart","followers_url":"https://api.github.com/users/treshugart/followers","following_url":"https://api.github.com/users/treshugart/following{/other_user}","gists_url":"https://api.github.com/users/treshugart/gists{/gist_id}","starred_url":"https://api.github.com/users/treshugart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/treshugart/subscriptions","organizations_url":"https://api.github.com/users/treshugart/orgs","repos_url":"https://api.github.com/users/treshugart/repos","events_url":"https://api.github.com/users/treshugart/events{/privacy}","received_events_url":"https://api.github.com/users/treshugart/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/skatejs/skatejs/labels/breaking","name":"breaking","color":"fbca04"},{"url":"https://api.github.com/repos/skatejs/skatejs/labels/rfc","name":"rfc","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-08-14T22:20:44Z","updated_at":"2015-09-11T07:03:21Z","closed_at":null,"body":"Currently we have:\r\n\r\n- `attr`\r\n- `init` see https://github.com/skatejs/skatejs/issues/270#issuecomment-136902990\r\n- `type`\r\n- `get`\r\n- `set`\r\n\r\nDo we want to change these?\r\n\r\n## My 2c\r\n\r\n### `attr`\r\n\r\nMaybe:\r\n\r\n- `attribute`\r\n- `attrLink`\r\n- `attributeLink`\r\n- `linkAttribute`\r\n\r\nRemember:\r\n\r\n- If `true` it `dash-cases` the property name and uses that as the linked attribute.\r\n- If `falsy` it doesn't link it at all.\r\n- If a `string` it uses the provided string as the attribute name to link.\r\n\r\n### `init`\r\n\r\nMaybe:\r\n\r\n- `default` (but that's a keyword)\r\n- `defaultValue`\r\n- `value` (clashes with normal `defineProperty` option, but we can get around that)\r\n- `initialValue`\r\n\r\nRemember:\r\n\r\n- If it's a `function` then the return value of the function becomes the initial value.\r\n- Any other value is the exact value of the property.\r\n\r\n### `type`\r\n\r\nMaybe:\r\n\r\n- `coerce`\r\n\r\nRemember:\r\n\r\n- It should coerce the value, but you can also do type checking here or throw errors if it's empty (required). Type checking et al can also go in `set` if you really want.\r\n\r\n### `get`\r\n\r\nI think this should be removed altogether. It kind of defies the rest of the options. If you want to make a readonly property, them you can probably just put a getter on the `prototype`.\r\n\r\n### `set`\r\n\r\nMaybe:\r\n\r\n- `change`\r\n- `update`\r\n- `set` is good, but it kind of implies there's also a corresponding `get`\r\n\r\nRemember:\r\n\r\n- It has the same semantics as a normal property setter, but it receives two parameters:\r\n  - `newValue`\r\n  - `oldValue`\r\n\r\n### One last question...\r\n\r\nDo we want to support normal `defineProperty` options?"},"comment":{"url":"https://api.github.com/repos/skatejs/skatejs/issues/comments/139468548","html_url":"https://github.com/skatejs/skatejs/issues/281#issuecomment-139468548","issue_url":"https://api.github.com/repos/skatejs/skatejs/issues/281","id":139468548,"user":{"login":"bqx","id":3261681,"avatar_url":"https://avatars.githubusercontent.com/u/3261681?v=3","gravatar_id":"","url":"https://api.github.com/users/bqx","html_url":"https://github.com/bqx","followers_url":"https://api.github.com/users/bqx/followers","following_url":"https://api.github.com/users/bqx/following{/other_user}","gists_url":"https://api.github.com/users/bqx/gists{/gist_id}","starred_url":"https://api.github.com/users/bqx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bqx/subscriptions","organizations_url":"https://api.github.com/users/bqx/orgs","repos_url":"https://api.github.com/users/bqx/repos","events_url":"https://api.github.com/users/bqx/events{/privacy}","received_events_url":"https://api.github.com/users/bqx/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T07:03:21Z","updated_at":"2015-09-11T07:03:21Z","body":"Now that `properties` doesn't trigger the `attributeChangedCallback`, there's no nice way of triggering the `update()` function for a property when trying to initialise it with a value. You could pull the `update()` code out into a function and call it in `created` or `ready`, but when you have a lot of properties you want to do this for it gets quite wordy.\r\n\r\nMaybe a `created` callback that you can specify for each property, or a `updateOnInit` flag set on each property could make this easier?"}}