{"action":"created","issue":{"url":"https://api.github.com/repos/Wirecloud/wirecloud/issues/48","labels_url":"https://api.github.com/repos/Wirecloud/wirecloud/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/Wirecloud/wirecloud/issues/48/comments","events_url":"https://api.github.com/repos/Wirecloud/wirecloud/issues/48/events","html_url":"https://github.com/Wirecloud/wirecloud/issues/48","id":103673910,"number":48,"title":"Widget close event","user":{"login":"borisbrdaric","id":14012281,"avatar_url":"https://avatars.githubusercontent.com/u/14012281?v=3","gravatar_id":"","url":"https://api.github.com/users/borisbrdaric","html_url":"https://github.com/borisbrdaric","followers_url":"https://api.github.com/users/borisbrdaric/followers","following_url":"https://api.github.com/users/borisbrdaric/following{/other_user}","gists_url":"https://api.github.com/users/borisbrdaric/gists{/gist_id}","starred_url":"https://api.github.com/users/borisbrdaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/borisbrdaric/subscriptions","organizations_url":"https://api.github.com/users/borisbrdaric/orgs","repos_url":"https://api.github.com/users/borisbrdaric/repos","events_url":"https://api.github.com/users/borisbrdaric/events{/privacy}","received_events_url":"https://api.github.com/users/borisbrdaric/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Wirecloud/wirecloud/labels/New%20Feature","name":"New Feature","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-28T08:48:32Z","updated_at":"2015-09-02T11:33:19Z","closed_at":null,"body":"When user closes widget (select 'Close' button in top right corner of the widget) it should be possible to detect this event programmatically.\r\n\r\nIn addition, the same principle should be applied on the rest of the widget manipulation options (e.g. minimize, maximize, full dragboard, exit full dragboard, extract from grid, snap to grid, rename)."},"comment":{"url":"https://api.github.com/repos/Wirecloud/wirecloud/issues/comments/137038792","html_url":"https://github.com/Wirecloud/wirecloud/issues/48#issuecomment-137038792","issue_url":"https://api.github.com/repos/Wirecloud/wirecloud/issues/48","id":137038792,"user":{"login":"aarranz","id":841201,"avatar_url":"https://avatars.githubusercontent.com/u/841201?v=3","gravatar_id":"","url":"https://api.github.com/users/aarranz","html_url":"https://github.com/aarranz","followers_url":"https://api.github.com/users/aarranz/followers","following_url":"https://api.github.com/users/aarranz/following{/other_user}","gists_url":"https://api.github.com/users/aarranz/gists{/gist_id}","starred_url":"https://api.github.com/users/aarranz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aarranz/subscriptions","organizations_url":"https://api.github.com/users/aarranz/orgs","repos_url":"https://api.github.com/users/aarranz/repos","events_url":"https://api.github.com/users/aarranz/events{/privacy}","received_events_url":"https://api.github.com/users/aarranz/received_events","type":"User","site_admin":false},"created_at":"2015-09-02T11:33:18Z","updated_at":"2015-09-02T11:33:18Z","body":"Seems a great idea :+1: . Probably we need to provide a generic API for registering event listeners.\r\n\r\nIn the mean time, you can detect when a widget has been unloaded (its not the same than detecting when a widget has been close, but can be useful in some situations) by using the `beforeunload` event:\r\n\r\n```javascript\r\nwindow.addEventListener(\"beforeunload\", ...)\r\n```\r\nAnd you can also detect when a widget has been renamed:\r\n\r\n```javascript\r\n    MashupPlatform.widget.context.registerCallback(function (new_values) {\r\n        if ('title' in new_values) {\r\n            // new_values.title contains the new name of the widget\r\n        }\r\n    });\r\n```"}}