diff --git a/karma.conf.js b/karma.conf.js
index 2f47399..3370daf 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -21,7 +21,8 @@ module.exports = function (config)
'test/resources.js',
'test/snippets.js',
'test/sources.js',
- 'test/settings.js'
+ 'test/settings.js',
+ 'test/eruda.js'
],
plugins: [
'karma-jasmine',
diff --git a/script/coverage.js b/script/coverage.js
index 1c9f391..075933e 100644
--- a/script/coverage.js
+++ b/script/coverage.js
@@ -9,7 +9,7 @@ var remappedJson = require('../coverage/coverage-remapped.json');
var coverage = util.reduce(util.keys(remappedJson), function (result, source)
{
- if (source.match(/src.*\.js$/) && source.indexOf('node_modules') < 0)
+ if (isSrc())
{
var correctPath = source.replace(path.resolve(__dirname, '../src'), path.resolve(__dirname, '../'));
@@ -18,6 +18,13 @@ var coverage = util.reduce(util.keys(remappedJson), function (result, source)
result[correctPath] = val;
}
+ function isSrc(src)
+ {
+ return source.match(/src.*\.js$/) &&
+ source.indexOf('node_modules') < 0 &&
+ source.indexOf('modernizr') < 0;
+ }
+
return result;
}, {});
diff --git a/script/webpack.dev.js b/script/webpack.dev.js
index c0c8180..6bb42c1 100644
--- a/script/webpack.dev.js
+++ b/script/webpack.dev.js
@@ -3,7 +3,7 @@ var webpack = require('webpack');
exports = require('./webpack.base');
exports.output.filename = 'eruda.js';
-exports.devtool = false;
+exports.devtool = 'source-map';
exports.plugins = exports.plugins.concat([
new webpack.DefinePlugin({
ENV: '"development"',
diff --git a/src/DevTools/DevTools.js b/src/DevTools/DevTools.js
index a9ce673..42e921c 100644
--- a/src/DevTools/DevTools.js
+++ b/src/DevTools/DevTools.js
@@ -53,8 +53,8 @@ export default class DevTools extends util.Emitter
}
add(tool)
{
- let {init, show, hide} = new Tool();
- util.defaults(tool, {init, show, hide});
+ let {init, show, hide, destroy} = new Tool();
+ util.defaults(tool, {init, show, hide, destroy});
let name = tool.name;
if (!name) return logger.error('You must specify a name for a tool');
diff --git a/src/index.js b/src/index.js
index 525af1e..279f578 100644
--- a/src/index.js
+++ b/src/index.js
@@ -16,12 +16,12 @@ import logger from './lib/logger'
import extraUtil from './lib/extraUtil'
module.exports = {
- init({el, tool, autoScale = true} = {})
+ init({container, tool, autoScale = true} = {})
{
this._isInit = true;
this._scale = 1;
- this._initContainer(el);
+ this._initContainer(container);
this._initStyle();
this._initDevTools();
this._initEntryBtn();
@@ -81,26 +81,28 @@ module.exports = {
{
this._devTools.destroy();
delete this._devTools;
- this.entryBtn.destroy();
- delete this.entryBtn;
+ this._entryBtn.destroy();
+ delete this._entryBtn;
this._unregisterListener();
this._$el.remove();
util.evalCss.clear();
},
- getScale()
+ scale(s)
{
+ if (util.isNum(s))
+ {
+ this._scale = s;
+ emitter.emit(emitter.SCALE, s);
+ return this;
+ }
+
return this._scale;
},
- setScale(scale)
- {
- this._scale = scale;
- emitter.emit(emitter.SCALE, scale);
- },
_autoScale()
{
if (!util.isMobile()) return;
- this.setScale(1 / util.viewportScale());
+ this.scale(1 / util.viewportScale());
},
_registerListener()
{
@@ -161,8 +163,8 @@ module.exports = {
},
_initEntryBtn()
{
- this.entryBtn = new EntryBtn(this._$el);
- this.entryBtn.on('click', () => this._devTools.toggle());
+ this._entryBtn = new EntryBtn(this._$el);
+ this._entryBtn.on('click', () => this._devTools.toggle());
},
_initSettings()
{
@@ -171,7 +173,7 @@ module.exports = {
devTools.add(settings);
- this.entryBtn.initCfg(settings);
+ this._entryBtn.initCfg(settings);
devTools.initCfg(settings);
},
_initTools(tool = ['console', 'elements', 'network', 'resources', 'sources', 'info', 'snippets', 'features'])
diff --git a/test/index.html b/test/index.html
index 5c7a2f0..fb67fe1 100644
--- a/test/index.html
+++ b/test/index.html
@@ -11,6 +11,9 @@