changlin-wdtools
v1.2.4
Published
The functions that be used in the browser environment
Downloads
1
Readme
changlin-wdtools
浏览器环境中使用的一些函数 / The functions that be used in the browser environment
安装
npm i changlin-wdtools --save
//或者
npm install changlin-wdtools --save
使用
//引入模块内函数
import {setCookie} from "changlin-wdtools"
Constants
Functions
hasTransition
Support transition
Kind: global constant
setCookieDefaultConfig(config) ⇒ undefined
修改默认cookie设置
Kind: global function
| Param | Type | | --- | --- | | config | object |
Example
setCookieDefaultConfig({
maxAge:3600,
path:'/',
domain:'abc.com'
})
getCookie(name) ⇒ string
获取cookie值
Kind: global function
| Param | Type | | --- | --- | | name | string |
Example
getCookie('cookieName')
getCookieObject(name) ⇒ object
获取cookie值,并解析为对象
Kind: global function
| Param | Type | | --- | --- | | name | string |
Example
getCookieObject('cookieName')
setCookie(name, value, attributes) ⇒ string
设置cookie值
Kind: global function
| Param | Type | Description | | --- | --- | --- | | name | string | cookie name | | value | string | number | object | cookie value | | attributes | object | cookie config |
deleteCookie(name) ⇒ string
删除 cookie
Kind: global function
| Param | Type | Description | | --- | --- | --- | | name | string | cookie name |
searchParse(search) ⇒ object
解析window.location.search
Kind: global function
| Param | Type | | --- | --- | | search | string |
Example
searchParse('?c=4&b=5')//=>{c:4,b:5}
searchStringify(object) ⇒ string
将对象转为字符串,window.location.search格式 (注意返回字符串不含?)
Kind: global function
| Param | Type | | --- | --- | | object | object |
Example
searchStringify({a:'1234'})//=>'a=1234'
searchExtend(arguments) ⇒ string
合并所有参数,返回字符串 (注意返回字符串不含?)
Kind: global function
| Param | Type | | --- | --- | | arguments | object | string |
Example
searchExtend('?a=3&b=4', {b:5}, {b:6,c:7})//=>'a=3&b=6&c=7'
getAbsoluteURL(location) ⇒ string
获取绝对URL
Kind: global function
| Param | Type | | --- | --- | | location | string |
isWeiXin() ⇒ boolean
判断是否为微信浏览器
Kind: global function
isAndroid() ⇒ boolean
判断是否为安卓端
Kind: global function
isIOS() ⇒ boolean
判断是否为IOS端
Kind: global function
requestAnimationFrame(callback) ⇒ number
Kind: global function
| Param | Type | | --- | --- | | callback | function |
cancelAnimationFrame(id) ⇒ undefined
Kind: global function
| Param | Type | | --- | --- | | id | number |
cssPrefix(key) ⇒ string
prefix css
Kind: global function
| Param | Type | | --- | --- | | key | string |
css(el, key, value) ⇒ string
set or get style
Kind: global function
| Param | Type | | --- | --- | | el | object | | key | string | | value | string |
addEventListener(el, type, fn, useCapture) ⇒ undefined
addEventListener
Kind: global function
| Param | Type | | --- | --- | | el | object | | type | string | | fn | function | | useCapture | boolean |
removeEventListener(el, type, fn, useCapture) ⇒ undefined
removeEventListener
Kind: global function
| Param | Type | | --- | --- | | el | object | | type | string | | fn | function | | useCapture | boolean |
findEL(any) ⇒ null | object
Kind: global function
| Param | Type | | --- | --- | | any | * |
findELs(any) ⇒ array
Kind: global function
| Param | | --- | | any |
offset(el) ⇒ Object
Kind: global function
| Param | Type | | --- | --- | | el | object |