{"action":"created","issue":{"url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/448","labels_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/448/labels{/name}","comments_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/448/comments","events_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/448/events","html_url":"https://github.com/katspaugh/wavesurfer.js/pull/448","id":73532232,"number":448,"title":"limit regions/callback on region update/create","user":{"login":"glebcha","id":2785780,"avatar_url":"https://avatars.githubusercontent.com/u/2785780?v=3","gravatar_id":"","url":"https://api.github.com/users/glebcha","html_url":"https://github.com/glebcha","followers_url":"https://api.github.com/users/glebcha/followers","following_url":"https://api.github.com/users/glebcha/following{/other_user}","gists_url":"https://api.github.com/users/glebcha/gists{/gist_id}","starred_url":"https://api.github.com/users/glebcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glebcha/subscriptions","organizations_url":"https://api.github.com/users/glebcha/orgs","repos_url":"https://api.github.com/users/glebcha/repos","events_url":"https://api.github.com/users/glebcha/events{/privacy}","received_events_url":"https://api.github.com/users/glebcha/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-06T06:36:25Z","updated_at":"2015-05-06T06:42:19Z","closed_at":"2015-05-06T06:42:19Z","pull_request":{"url":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/448","html_url":"https://github.com/katspaugh/wavesurfer.js/pull/448","diff_url":"https://github.com/katspaugh/wavesurfer.js/pull/448.diff","patch_url":"https://github.com/katspaugh/wavesurfer.js/pull/448.patch"},"body":"Regions count limit patch\r\n--------\r\nUse option 'count: integer'\r\n\r\nRegions callback\r\n--------\r\nUse option regionsCallback\r\nCall wavesurfer.regionsCallback\r\n\r\nExample\r\n--------\r\n    //Save time to input and localStorage.\r\n    var saveRegion = function() {\r\n        var regionHolder = document.getElementById('region-data'),\r\n            regions = wavesurfer.regions.list,\r\n            regionsObj = Object.keys(regions).map(function (id) {\r\n                var region = regions[id];\r\n                return {\r\n                    start: region.start,\r\n                    end: region.end\r\n                };\r\n            });\r\n\r\n        for (var i = 0; i < regionsObj.length; i++) {\r\n            var audioRegion = regionsObj[i],\r\n                start = Math.round(audioRegion.start),\r\n                end = Math.round(audioRegion.end);\r\n            startInput.value = start;\r\n            endInput.value = end;\r\n        }\r\n\r\n        localStorage.regions = JSON.stringify(regionsObj);\r\n    };\r\n\r\n    if (wavesurfer.enableDragSelection) {\r\n        wavesurfer.enableDragSelection({\r\n            color: 'rgba(0, 255, 0, 0.1)',\r\n            count: 1 \r\n        });\r\n        wavesurfer.regionsCallback = saveRegion;\r\n    }"},"comment":{"url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/comments/99344625","html_url":"https://github.com/katspaugh/wavesurfer.js/pull/448#issuecomment-99344625","issue_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/448","id":99344625,"user":{"login":"katspaugh","id":381895,"avatar_url":"https://avatars.githubusercontent.com/u/381895?v=3","gravatar_id":"","url":"https://api.github.com/users/katspaugh","html_url":"https://github.com/katspaugh","followers_url":"https://api.github.com/users/katspaugh/followers","following_url":"https://api.github.com/users/katspaugh/following{/other_user}","gists_url":"https://api.github.com/users/katspaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/katspaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katspaugh/subscriptions","organizations_url":"https://api.github.com/users/katspaugh/orgs","repos_url":"https://api.github.com/users/katspaugh/repos","events_url":"https://api.github.com/users/katspaugh/events{/privacy}","received_events_url":"https://api.github.com/users/katspaugh/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T06:42:19Z","updated_at":"2015-05-06T06:42:19Z","body":"No, sorry.\r\n\r\n 1. Counting can be easily done in the application code, so I don't see any reasons to include it into the plugin.\r\n 2. We don't provide callbacks in the API. We emit events."}}