-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Stats class accept stats in constructor #92
Conversation
docs/api-reference/log/stats.md
Outdated
|
||
* `id` (`String`) - the id of the `Stats` object. | ||
* `stats` (`String`) - the list of stats. Each element in the stats could be either`Stat` object or `{id, type}` (type is optional, default is `count`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: stats
type: String[] | Object[]
or (String | Object)[]
An alternative is to make type an Object
map with id
s as keys. This way we could separating id
(easy to use in code) from name
(being a printable, human readable name to use in the stats widget).
new Stats({
id,
stats: {
count: {name: 'Count', type: 'count', resetOnUpdate: true}
}
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do another PR to resolve this
@@ -154,7 +154,7 @@ export default class StatsWidget { | |||
} | |||
|
|||
_createDOMStats() { | |||
if (this.stats && this.stats.size) { | |||
if (this.stats instanceof Stats) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stats could be empty
No description provided.