| 107163 | var _vegaLoader = require("vega-loader"); |
| 107164 | var _vegaFormat = require("vega-format"); |
| 107165 | function UniqueList(idFunc) { |
| 107166 | const $ = idFunc || (0, _vegaUtil.identity), list = [], ids = {}; |
| 107167 | list.add = (_)=>{ |
| 107168 | const id = $(_); |
| 107169 | if (!ids[id]) { |
| 107170 | ids[id] = 1; |
| 107171 | list.push(_); |
| 107172 | } |
| 107173 | return list; |
| 107174 | }; |
| 107175 | list.remove = (_)=>{ |
| 107176 | const id = $(_); |
| 107177 | if (ids[id]) { |
| 107178 | ids[id] = 0; |
| 107179 | const idx = list.indexOf(_); |
| 107180 | if (idx >= 0) list.splice(idx, 1); |
| 107181 | } |
| 107182 | return list; |
| 107183 | }; |
| 107184 | return list; |
| 107185 | } |
| 107186 | /** |
| 107187 | * Invoke and await a potentially async callback function. If |
| 107188 | * an error occurs, trap it and route to Dataflow.error. |