{"action":"created","issue":{"url":"https://api.github.com/repos/wycats/javascript-decorators/issues/4","labels_url":"https://api.github.com/repos/wycats/javascript-decorators/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/wycats/javascript-decorators/issues/4/comments","events_url":"https://api.github.com/repos/wycats/javascript-decorators/issues/4/events","html_url":"https://github.com/wycats/javascript-decorators/issues/4","id":62801916,"number":4,"title":"Allow decorators for functions as well","user":{"login":"svieira","id":143435,"avatar_url":"https://avatars.githubusercontent.com/u/143435?v=3","gravatar_id":"","url":"https://api.github.com/users/svieira","html_url":"https://github.com/svieira","followers_url":"https://api.github.com/users/svieira/followers","following_url":"https://api.github.com/users/svieira/following{/other_user}","gists_url":"https://api.github.com/users/svieira/gists{/gist_id}","starred_url":"https://api.github.com/users/svieira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svieira/subscriptions","organizations_url":"https://api.github.com/users/svieira/orgs","repos_url":"https://api.github.com/users/svieira/repos","events_url":"https://api.github.com/users/svieira/events{/privacy}","received_events_url":"https://api.github.com/users/svieira/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2015-03-18T21:12:25Z","updated_at":"2015-04-22T08:46:34Z","closed_at":"2015-03-19T12:56:21Z","body":"Decorators for classes, methods, and object properties are a really nice extension to the language.  The only extra one I would *like* to see is the ability to add decorators to function declarations:\r\n\r\n```\r\n@RunOnce\r\nfunction expensiveOperation() {\r\n    return 1 + 1;\r\n}\r\n```\r\n\r\nde-sugars to:\r\n\r\n```\r\nvar expensiveOperation = RunOnce(function expensiveOperation() {\r\n  return 1 + 1;\r\n});\r\n```\r\n\r\n----\r\n\r\nThis *suggests* allowing decorators for any assignment, but I think that might be a bit much so I'm leaving it out of this PR:\r\n\r\n```\r\n// For the curious, that would allow constructs like this\r\n@RunOnce\r\nlet expensiveOp = () => 1 + 1\r\n\r\n// De-sugars to\r\n\r\nlet expensiveOp = RunOnce(() => 1 + 1);\r\n```"},"comment":{"url":"https://api.github.com/repos/wycats/javascript-decorators/issues/comments/95079945","html_url":"https://github.com/wycats/javascript-decorators/issues/4#issuecomment-95079945","issue_url":"https://api.github.com/repos/wycats/javascript-decorators/issues/4","id":95079945,"user":{"login":"sebmck","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/sebmck","html_url":"https://github.com/sebmck","followers_url":"https://api.github.com/users/sebmck/followers","following_url":"https://api.github.com/users/sebmck/following{/other_user}","gists_url":"https://api.github.com/users/sebmck/gists{/gist_id}","starred_url":"https://api.github.com/users/sebmck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebmck/subscriptions","organizations_url":"https://api.github.com/users/sebmck/orgs","repos_url":"https://api.github.com/users/sebmck/repos","events_url":"https://api.github.com/users/sebmck/events{/privacy}","received_events_url":"https://api.github.com/users/sebmck/received_events","type":"User","site_admin":false},"created_at":"2015-04-22T08:46:34Z","updated_at":"2015-04-22T08:46:34Z","body":"@ivan-kleshnin Do you mean behind a directive?"}}