Skip to content

Commit 7155031

Browse files
committed
feat: add className
1 parent f65220a commit 7155031

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

monitor.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,12 @@ var create = function() {
102102
styles[i] = this.options.containerStyles[i];
103103
}
104104

105+
var cssText = '';
105106
Object.keys(styles).forEach(function(key) {
106-
container.style.cssText += key + ':' + styles[key];
107+
cssText += key + ':' + styles[key] + ';';
107108
});
109+
container.className = 'monitor-fps-board';
110+
container.style.cssText = cssText;
108111

109112
container.addEventListener('click', function(e) {
110113
e.preventDefault();
@@ -117,7 +120,7 @@ var create = function() {
117120

118121
function FPSBoard(options) {
119122
var opts = options || {};
120-
opts.container = document.querySelector(opts.container) || document.body;
123+
opts.container = opts.container instanceof HTMLElement ? opts.container : (document.querySelector(opts.container) || document.body);
121124
opts.width = opts.width || 80;
122125
opts.height = opts.height || 48;
123126
opts.alpha = opts.alpha || 0.9;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monitor.js",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "performance monitor for browser runtime",
55
"keywords": [
66
"monitor"

0 commit comments

Comments
 (0)