Resources/public/js/services/comments/router.js   A
last analyzed

Complexity

Total Complexity 7
Complexity/F 1.17

Size

Lines of Code 33
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 33
rs 10
c 0
b 0
f 0
cc 0
nc 2
mnd 1
bc 7
fnc 6
bpm 1.1666
cpm 1.1666
noi 0
1
/*
2
 * This file is part of Sulu.
3
 *
4
 * (c) MASSIVE ART WebServices GmbH
5
 *
6
 * This source file is subject to the MIT license that is bundled
7
 * with this source code in the file LICENSE.
8
 */
9
10
define(['services/husky/util', 'services/husky/mediator'], function(Util, Mediator) {
11
12
    'use strict';
13
14
    var instance = null,
15
16
        getInstance = function() {
17
            if (instance === null) {
18
                instance = new CommentRouter();
19
            }
20
21
            return instance;
22
        },
23
24
        navigate = function(route) {
25
            Mediator.emit('sulu.router.navigate', route, true, true);
26
        };
27
28
    /** @constructor **/
29
    function CommentRouter() {
30
    }
31
32
    CommentRouter.prototype = {
33
        toList: function() {
34
            navigate('comments');
35
        },
36
        toEdit: function(id, content) {
37
            navigate('comments/edit:' + id + '/' + (content || 'details'));
38
        }
39
    };
40
41
    return getInstance();
42
});
43