Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
histhub
geolinker-common
Commits
7ce78108
Commit
7ce78108
authored
Aug 02, 2018
by
Tobias Steiner
Browse files
Add a shortcut to retrieve a named reporter
parent
d755c066
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/core.ts
View file @
7ce78108
...
...
@@ -6,6 +6,7 @@ import {LoggerInstance} from 'winston';
import
UriBuilder
from
'
./uri-builder
'
;
import
{
InterfaceReporter
,
InterfaceReporterCollection
,
Reporter
}
from
'
./reporter
'
;
import
fs
=
require
(
'
fs
'
);
import
{
InterfaceCore
}
from
'
../dist/core
'
;
export
interface
InterfaceCore
{
name
:
string
;
...
...
@@ -102,11 +103,18 @@ class Core {
/**
* Get a singleton reporter instance with a specific name
* @param {number
} interval
* @param {number
| string} nameOrInterval The interval or a shortcut for the name
* @param {string} name
* @returns {Reporter}
*/
public
getReporter
(
interval
:
number
=
10000
,
name
:
string
=
'
default
'
):
InterfaceReporter
{
public
getReporter
(
nameOrInterval
:
number
|
string
=
10000
,
name
:
string
=
'
default
'
):
InterfaceReporter
{
let
interval
=
10000
;
if
(
typeof
nameOrInterval
===
'
number
'
)
{
interval
=
nameOrInterval
;
}
else
{
name
=
nameOrInterval
;
}
let
reporter
=
this
.
reporter
.
find
((
r
)
=>
r
.
name
===
name
);
if
(
typeof
reporter
===
'
undefined
'
)
{
reporter
=
{
name
,
reporter
:
new
Reporter
(
this
,
interval
)};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment