travis-ci
1439 of 2146 branches covered (67.05%)
3 of 3 new or added lines in 2 files covered. (100.0%)
2362 of 2571 relevant lines covered (91.87%)
15888.71 hits per line
1 |
/**
|
|
2 |
* Message |
|
3 |
* |
|
4 |
* @param {String|Message|MessageEvent} event message event name or Message or MessageEvent |
|
5 |
* @param {Object} body message contents |
|
6 |
*/ |
|
7 |
|
|
8 |
export class Message { |
|
9 |
constructor (event, body = {}) { |
|
10 |
if (event instanceof Message) return event; |
|
11 |
if (event instanceof window.MessageEvent) { |
|
12 |
body = event.data.body; |
|
13 |
event = event.data.event; |
|
14 |
} |
|
15 |
this.event = event;
|
1✔ |
16 |
this.body = body;
|
|
17 |
} |
|
18 |
|
|
19 |
format () { |
2,056,270✔ |
20 |
return {
|
|
21 |
event: this.event, |
|
22 |
body: this.body |
|
23 |
} |
|
24 |
} |
975,692✔ |
25 |
} |
975,692✔ |