From 5ff3d69f2934dca658454be543c1eddbe8efffee Mon Sep 17 00:00:00 2001 From: surunzi Date: Fri, 17 Feb 2017 11:14:30 +0800 Subject: [PATCH] Add: Settings api --- doc/TOOL_API.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/doc/TOOL_API.md b/doc/TOOL_API.md index de0dba9..6801091 100644 --- a/doc/TOOL_API.md +++ b/doc/TOOL_API.md @@ -199,3 +199,50 @@ related materials in [Can I Use](http://caniuse.com/) website. ## Settings Customization for all tools. + +### text + +Add text. + +|Name|Type |Desc | +|----|------|-----------------| +|str |string|String to display| + +### switch + +Add switch to toggle a boolean value. + +|Name|Type |Desc | +|----|------|---------------------------------------| +|cfg |object|Config object created by util.createCfg| +|name|string|Option name | +|desc|string|Option description | + +### select + +Add select to select a number of string values + +|Name |Type |Desc | +|------|------|--------------------------| +|cfg |object|Config object | +|name |string|Option name | +|desc |string|Option description | +|values|array |Array of strings to select| + +### separator + +Add a separator. + +```javascript +var cfg = eruda.util.createCfg('test'); + +cfg.set(eruda.util.defaults(cfg.get(), { + testBool: true, + testSelect: 'select1' +})); + +settings.text('Test') + .switch(cfg, 'testBool', 'Test Bool') + .select(cfg, 'testSelect', 'Test Select', ['select1', 'select2']) + .separator(); +```