mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 14:38:05 +02:00
added IssueManager
- IssueManager performs validation on the current graph and also stores the issues and notifies listeners when the issues changed
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import * as d3 from 'd3';
|
||||
import { utilRebind } from '../util/rebind';
|
||||
|
||||
export function IssueManager(context) {
|
||||
var dispatch = d3.dispatch('reload'),
|
||||
self = {},
|
||||
issues = [];
|
||||
|
||||
self.getIssues = function() {
|
||||
self.validate();
|
||||
return issues;
|
||||
};
|
||||
|
||||
self.validate = function() {
|
||||
var changes = context.history().changes();
|
||||
issues = context.history().validate(changes);
|
||||
dispatch.call('reload', self, issues);
|
||||
return issues;
|
||||
};
|
||||
|
||||
return utilRebind(self, dispatch, 'on');
|
||||
}
|
||||
Reference in New Issue
Block a user