{"action":"closed","issue":{"url":"https://api.github.com/repos/mobxjs/mobx/issues/370","repository_url":"https://api.github.com/repos/mobxjs/mobx","labels_url":"https://api.github.com/repos/mobxjs/mobx/issues/370/labels{/name}","comments_url":"https://api.github.com/repos/mobxjs/mobx/issues/370/comments","events_url":"https://api.github.com/repos/mobxjs/mobx/issues/370/events","html_url":"https://github.com/mobxjs/mobx/issues/370","id":162684412,"number":370,"title":"@intercept as function decorator","user":{"login":"mattiamanzati","id":13787614,"avatar_url":"https://avatars.githubusercontent.com/u/13787614?v=3","gravatar_id":"","url":"https://api.github.com/users/mattiamanzati","html_url":"https://github.com/mattiamanzati","followers_url":"https://api.github.com/users/mattiamanzati/followers","following_url":"https://api.github.com/users/mattiamanzati/following{/other_user}","gists_url":"https://api.github.com/users/mattiamanzati/gists{/gist_id}","starred_url":"https://api.github.com/users/mattiamanzati/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattiamanzati/subscriptions","organizations_url":"https://api.github.com/users/mattiamanzati/orgs","repos_url":"https://api.github.com/users/mattiamanzati/repos","events_url":"https://api.github.com/users/mattiamanzati/events{/privacy}","received_events_url":"https://api.github.com/users/mattiamanzati/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-06-28T13:22:03Z","updated_at":"2016-08-22T20:51:31Z","closed_at":"2016-08-22T20:51:31Z","body":"I am thinking; would be nice to have intercept as decorator as well?\r\n\r\nSomething like this:\r\n```javascript\r\nclass Todo{\r\n   @observable text = ''\r\n   @observable completed = false\r\n\r\n   @intercept(\"completed\")\r\n   function allowOnlyBoolean(change){\r\n      return [true, false].indexOf(change.newValue) > -1 ? change : null\r\n   }\r\n}\r\n```\r\n\r\nthe problem is about disposers; intercept should be disposed, so I am asking if somehow is there a way to implement this without the need of a disposer function.\r\nI will dig into mobx sources to discover more, if this is impossible or too hard."}}
{"actor":{"display_login":"mweststrate"}}