fe-utils
collect all kinds of utility functions that are often used by us.
Installation
In a browser:
<script src="fe-utils.js"></script>
Using npm:
$ npm i -g npm
$ npm i --save fe-utils
Usage:
var cookie = require('fe-utils/cookie')
var date = require('fe-utils/date')
...
allMethods:
-
NumberToChinese
NumberToChinese(12345)
NumberToChinese(12345, true)
-
cookie
setCookie(name, domain, domain, expiredays)
getCookie(name)
delCookie(name, domain)
-
date
dateFormat()
-
detectedInfos
isAndroid / isIOS / isWindowPhone / isWX / isWeibo / isMobile / isPC
-
preventViewScroll
https://github.com/lzwaiwai/preventViewScroll
-
urlQuery
const url = 'http://live.tinfinite.com:8080/path/chat-studio.html?liveshowId=592e4e2bf84e6e26c1cf97dd&group=live#123'
queryOne
queryAll
update
query: {
liveshowId: '592e4e2bf84e6e26c1cf97dd',
group: 'voice',
referer: 'list'
},
url: 'http://live.tinfinite.com:8080/path/chat-studio.html?liveshowId=592e4e2bf84e6e26c1cf97dd&group=voice&referer=list#123'
}
del
query: {
group: 'live'
},
url: 'http://live.tinfinite.com:8080/path/chat-studio.html?group=live#123'
}
query: {},
search: 'http://live.tinfinite.com:8080/path/chat-studio.html#123'
}
-
toRoman
toRoman(25)
-
getVersionOfIOS
getVersionOfIOS()
-
relProtocol
relProtocol('http://xxx.com')
-
logger
-
mediaError
mediaError(video / audio, (code, msg) => { ... })
-
loadJs
loadJs(url, callback)