{"action":"closed","issue":{"url":"https://api.github.com/repos/clientIO/joint/issues/239","repository_url":"https://api.github.com/repos/clientIO/joint","labels_url":"https://api.github.com/repos/clientIO/joint/issues/239/labels{/name}","comments_url":"https://api.github.com/repos/clientIO/joint/issues/239/comments","events_url":"https://api.github.com/repos/clientIO/joint/issues/239/events","html_url":"https://github.com/clientIO/joint/issues/239","id":132455158,"number":239,"title":"Batch-related API improvements for graph model","user":{"login":"chill117","id":1775417,"avatar_url":"https://avatars.githubusercontent.com/u/1775417?v=3","gravatar_id":"","url":"https://api.github.com/users/chill117","html_url":"https://github.com/chill117","followers_url":"https://api.github.com/users/chill117/followers","following_url":"https://api.github.com/users/chill117/following{/other_user}","gists_url":"https://api.github.com/users/chill117/gists{/gist_id}","starred_url":"https://api.github.com/users/chill117/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chill117/subscriptions","organizations_url":"https://api.github.com/users/chill117/orgs","repos_url":"https://api.github.com/users/chill117/repos","events_url":"https://api.github.com/users/chill117/events{/privacy}","received_events_url":"https://api.github.com/users/chill117/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/clientIO/joint/labels/enhancement","name":"enhancement","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-09T15:54:46Z","updated_at":"2016-02-25T12:44:07Z","closed_at":"2016-02-25T12:44:07Z","body":"Currently start/stopping batches of graph changes looks like this:\r\n```js\r\ngraph.trigger('batch:start', { batchName: 'some_batch', other: 'info' });\r\n// ..\r\ngraph.trigger('batch:stop', { batchName: 'some_batch', other: 'info' });\r\n```\r\n\r\nA cleaner looking approach could be:\r\n```js\r\ngraph.startBatch('layout', { other: 'info' });\r\n// ..\r\ngraph.stopBatch('layout', { other: 'info' });\r\n```\r\nWhere..\r\n* the first argument (batch name) is required\r\n* the second argument (batch data) is optional\r\n\r\nUnder-the-hood, the old way of doing batches (triggering the `batch:start` and `batch:stop` events) could be used. This would be a backwards compatible change.\r\n\r\nAlso we should add the following method for detecting if there is a batch in progress:\r\n```js\r\ngraph.hasActiveBatch([name])\r\n```\r\nWhere..\r\n* the `name` argument is optional"}}