Skip to content

Commit c7fb4a8

Browse files
committed
give event and timer a name for logging
1 parent 6d6522e commit c7fb4a8

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎src/Event.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
33

4+
import Log from './Log';
5+
46
export default class Event {
57

6-
constructor() {
8+
constructor(name) {
9+
this._name = name;
710
this._callbacks = [];
811
}
912

@@ -19,6 +22,7 @@ export default class Event {
1922
}
2023

2124
raise(...params) {
25+
Log.info("Raising event: " + this._name);
2226
for (var cb of this._callbacks) {
2327
cb(...params);
2428
}

‎src/Timer.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import Event from './Event';
77

88
export default class Timer extends Event {
99

10-
constructor(timer = Global.timer) {
11-
super();
10+
constructor(name, timer = Global.timer) {
11+
super(name);
1212
this._timer = timer;
1313
}
1414

‎test/unit/Event.spec.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("Event", function () {
1313
let subject;
1414

1515
beforeEach(function () {
16-
subject = new Event();
16+
subject = new Event("test name");
1717
});
1818

1919
describe("addHandler", function () {

‎test/unit/Timer.spec.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe("Timer", function () {
3131

3232
beforeEach(function () {
3333
stubWindowTimer = new StubWindowTimer();
34-
subject = new Timer(stubWindowTimer);
34+
subject = new Timer("test name", stubWindowTimer);
3535
});
3636

3737
describe("init", function () {

0 commit comments

Comments
 (0)