@@ 3427-3477 (lines=51) @@ | ||
3424 | /** |
|
3425 | * A helper, internal data structure that stores all references attached to key |
|
3426 | */ |
|
3427 | .factory('$$multiMap', function() { |
|
3428 | return { |
|
3429 | createNew: function() { |
|
3430 | var map = {}; |
|
3431 | ||
3432 | return { |
|
3433 | entries: function() { |
|
3434 | return Object.keys(map).map(function(key) { |
|
3435 | return { |
|
3436 | key: key, |
|
3437 | value: map[key] |
|
3438 | }; |
|
3439 | }); |
|
3440 | }, |
|
3441 | get: function(key) { |
|
3442 | return map[key]; |
|
3443 | }, |
|
3444 | hasKey: function(key) { |
|
3445 | return !!map[key]; |
|
3446 | }, |
|
3447 | keys: function() { |
|
3448 | return Object.keys(map); |
|
3449 | }, |
|
3450 | put: function(key, value) { |
|
3451 | if (!map[key]) { |
|
3452 | map[key] = []; |
|
3453 | } |
|
3454 | ||
3455 | map[key].push(value); |
|
3456 | }, |
|
3457 | remove: function(key, value) { |
|
3458 | var values = map[key]; |
|
3459 | ||
3460 | if (!values) { |
|
3461 | return; |
|
3462 | } |
|
3463 | ||
3464 | var idx = values.indexOf(value); |
|
3465 | ||
3466 | if (idx !== -1) { |
|
3467 | values.splice(idx, 1); |
|
3468 | } |
|
3469 | ||
3470 | if (!values.length) { |
|
3471 | delete map[key]; |
|
3472 | } |
|
3473 | } |
|
3474 | }; |
|
3475 | } |
|
3476 | }; |
|
3477 | }) |
|
3478 | ||
3479 | /** |
|
3480 | * Pluggable resolve mechanism for the modal resolve resolution |
@@ 3426-3476 (lines=51) @@ | ||
3423 | /** |
|
3424 | * A helper, internal data structure that stores all references attached to key |
|
3425 | */ |
|
3426 | .factory('$$multiMap', function() { |
|
3427 | return { |
|
3428 | createNew: function() { |
|
3429 | var map = {}; |
|
3430 | ||
3431 | return { |
|
3432 | entries: function() { |
|
3433 | return Object.keys(map).map(function(key) { |
|
3434 | return { |
|
3435 | key: key, |
|
3436 | value: map[key] |
|
3437 | }; |
|
3438 | }); |
|
3439 | }, |
|
3440 | get: function(key) { |
|
3441 | return map[key]; |
|
3442 | }, |
|
3443 | hasKey: function(key) { |
|
3444 | return !!map[key]; |
|
3445 | }, |
|
3446 | keys: function() { |
|
3447 | return Object.keys(map); |
|
3448 | }, |
|
3449 | put: function(key, value) { |
|
3450 | if (!map[key]) { |
|
3451 | map[key] = []; |
|
3452 | } |
|
3453 | ||
3454 | map[key].push(value); |
|
3455 | }, |
|
3456 | remove: function(key, value) { |
|
3457 | var values = map[key]; |
|
3458 | ||
3459 | if (!values) { |
|
3460 | return; |
|
3461 | } |
|
3462 | ||
3463 | var idx = values.indexOf(value); |
|
3464 | ||
3465 | if (idx !== -1) { |
|
3466 | values.splice(idx, 1); |
|
3467 | } |
|
3468 | ||
3469 | if (!values.length) { |
|
3470 | delete map[key]; |
|
3471 | } |
|
3472 | } |
|
3473 | }; |
|
3474 | } |
|
3475 | }; |
|
3476 | }) |
|
3477 | ||
3478 | /** |
|
3479 | * Pluggable resolve mechanism for the modal resolve resolution |