Doc: Readme and util api

This commit is contained in:
surunzi
2017-12-18 14:24:24 +08:00
parent 8275b53a4c
commit 2f9b39769b
2 changed files with 20 additions and 17 deletions

View File

@@ -105,7 +105,7 @@ eruda.init({
## Plugins
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.
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. Besides, [eruda-plugin](https://github.com/liriliri/eruda-plugin) is available for plugin initialization.
* [eruda-fps](https://github.com/liriliri/eruda-fps): Display page fps info.
* [eruda-features](https://github.com/liriliri/eruda-features): Browser feature detections.
@@ -114,7 +114,7 @@ It is possible to enhance Eruda with more features by writing plugins. Check sou
When writing plugins, you can use utilities exposed by Eruda, see [docs](doc/UTIL_API.md) here.
## Contributio
## Contribution
Read [Contributing Guide](doc/CONTRIBUTING.md) for development setup instructions.

View File

@@ -1009,6 +1009,24 @@ if (browser.name === 'ie' && browser.version < 9)
}
```
## detectOs
Detect operating system using ua.
|Name |Type |Desc |
|------------------------|------|---------------------|
|[ua=navigator.userAgent]|string|Browser userAgent |
|return |string|Operating system name|
Supported os: windows, os x, linux, ios, android, windows phone
```javascript
if (detectOs() === 'ios')
{
// Do something about ios...
}
```
## each
Iterate over elements of collection and invokes iteratee for each element.
@@ -1857,21 +1875,6 @@ query.stringify({foo: 'bar', eruda: 'true'}); // -> 'foo=bar&eruda=true'
query.parse('name=eruda&name=eustia'); // -> {name: ['eruda', 'eustia']}
```
## ready
Invoke callback when dom is ready, similar to jQuery ready.
|Name|Type |Desc |
|----|--------|-----------------|
|fn |function|Callback function|
```javascript
ready(function ()
{
// It's safe to manipulate dom here.
});
```
## repeat
Repeat string n-times.