From 2f9b39769b06b08b162f7f26513fdc64e4524d45 Mon Sep 17 00:00:00 2001 From: surunzi Date: Mon, 18 Dec 2017 14:24:24 +0800 Subject: [PATCH] Doc: Readme and util api --- README.md | 4 ++-- doc/UTIL_API.md | 33 ++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 39f2d0b..1388ce2 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/doc/UTIL_API.md b/doc/UTIL_API.md index e392509..9d823ab 100644 --- a/doc/UTIL_API.md +++ b/doc/UTIL_API.md @@ -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.