1.2.4 • Published 6 years ago

changlin-wdtools v1.2.4

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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

ParamType
configobject

Example

setCookieDefaultConfig({
 maxAge:3600,
path:'/',
domain:'abc.com'
})

getCookie(name) ⇒ string

获取cookie值

Kind: global function

ParamType
namestring

Example

getCookie('cookieName')

getCookieObject(name) ⇒ object

获取cookie值,并解析为对象

Kind: global function

ParamType
namestring

Example

getCookieObject('cookieName')

setCookie(name, value, attributes) ⇒ string

设置cookie值

Kind: global function

ParamTypeDescription
namestringcookie name
valuestring | number | objectcookie value
attributesobjectcookie config

deleteCookie(name) ⇒ string

删除 cookie

Kind: global function

ParamTypeDescription
namestringcookie name

searchParse(search) ⇒ object

解析window.location.search

Kind: global function

ParamType
searchstring

Example

searchParse('?c=4&b=5')//=>{c:4,b:5}

searchStringify(object) ⇒ string

将对象转为字符串,window.location.search格式 (注意返回字符串不含?)

Kind: global function

ParamType
objectobject

Example

searchStringify({a:'1234'})//=>'a=1234'

searchExtend(arguments) ⇒ string

合并所有参数,返回字符串 (注意返回字符串不含?)

Kind: global function

ParamType
argumentsobject | 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

ParamType
locationstring

isWeiXin() ⇒ boolean

判断是否为微信浏览器

Kind: global function

isAndroid() ⇒ boolean

判断是否为安卓端

Kind: global function

isIOS() ⇒ boolean

判断是否为IOS端

Kind: global function

requestAnimationFrame(callback) ⇒ number

Kind: global function

ParamType
callbackfunction

cancelAnimationFrame(id) ⇒ undefined

Kind: global function

ParamType
idnumber

cssPrefix(key) ⇒ string

prefix css

Kind: global function

ParamType
keystring

css(el, key, value) ⇒ string

set or get style

Kind: global function

ParamType
elobject
keystring
valuestring

addEventListener(el, type, fn, useCapture) ⇒ undefined

addEventListener

Kind: global function

ParamType
elobject
typestring
fnfunction
useCaptureboolean

removeEventListener(el, type, fn, useCapture) ⇒ undefined

removeEventListener

Kind: global function

ParamType
elobject
typestring
fnfunction
useCaptureboolean

findEL(any) ⇒ null | object

Kind: global function

ParamType
any*

findELs(any) ⇒ array

Kind: global function

Param
any

offset(el) ⇒ Object

Kind: global function

ParamType
elobject
1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

7 years ago