Dev: Update README

This commit is contained in:
surunzi
2016-05-19 12:24:15 +08:00
parent 5e9a0ce53c
commit 621679a1fe

View File

@@ -2,7 +2,7 @@
Console for Mobile Browsers.
![Eruda](http://7xn2zy.com1.z0.glb.clouddn.com/eruda_screenshot.jpg)
![Eruda](http://7xn2zy.com1.z0.glb.clouddn.com/eruda_screenshot2.jpg)
## Why
@@ -27,7 +27,7 @@ javascript:(function () { var script = document.createElement('script'); script.
* Network: Show performance timing, ajax requests status.
* Resource: Show localStorage, cookie information.
* Info: Show url, user agent info.
* Snippets: Include snippets you used most often.
* Snippets: Include snippets used most often.
* Sources: Html, js, css source viewer.
* Features: Browser feature detections.
@@ -41,22 +41,46 @@ npm install eruda --save
Add this script to your page.
```html
<script src="node_modules/eruda/dist/eruda.min.js'"></script>
<script>eruda.init();</script>
```
The JavaScript file size is quite huge(about 75kb gzipped) and therefore not
suitable to include in mobile pages. It's recommended to make sure eruda is
loaded only when eruda is set to true on url(http://example.com/?eruda=true),
for example:
```javascript
(function () {
var src = 'node_modules/eruda/dist/eruda.min.js';
if (!/eruda=true/.test(window.location) && localStorage.getItem('active-eruda') != 'true') return;
document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
document.write('<scr' + 'ipt>eruda.init();</scr' + 'ipt>');
})();
```
> The JavaScript file size is quite huge and therefore not suitable to include
in mobile pages. We add this script to make sure eruda is loaded only when eruda
is set to true on url(http://example.com/?eruda=true).
## Configuration
When initialization, a configuration object can be passed in.
* container: Container element. If not set, it will append a element directly
under html root element.
* tool: Choose which default tools you want, by default all will be added.
```javascript
eruda.init({
container: document.createElement('div'),
tool: ['console', 'elements']
});
```
## Plugins
It is possible to enhance Eruda with more features by writing plugins. Please check [eruda-fps](https://github.com/liriliri/eruda-fps), a plugin for displaying page
fps info, as a start example to write your own custom tool panels.
It is possible to enhance Eruda with more features by writing plugins. Check
source code of plugins below to learn how to write your own custom tool panels.
* [eruda-fps](https://github.com/liriliri/eruda-fps): Displaying page fps info.
## License