Skip to content

yejiayuan163/yjyJSmodule

Repository files navigation

adam-yjy

10 frequently-used function

Install

npm install adam-yjy

Usage

import Tool from 'adam-yjy'

function

query (name, querystring)

Gets the value of the specified name in the specified querystring

 Tool.query('hello', '?hello=js') //return 'js

serialize (data)

serialized objects

  Tool.serialize({hello: 'js', hi: 'test'}) return 'hello=js&hi=test'

$ (selector)

Lookup DOM according to the selector

 Tool.$ (selector) //return DOM

removeNode (node)

Delete the DOM node

insertAfter (node, target)

Insert the node node after the target node

addClass (node, className)

Add class to the specified DOM

removeClass (node, className)

Remove class from the specified DOM

getAbsoluteUrl (url)

Getting the absolute path on the current page

  Tool.getAbsoluteUrl('/jerojiang') => 'http://imweb.io/jerojiang'

debounce (callback, time = 500)

debounce

removeItemByIndex (index, arr)

Moving an item out of an array by index

  Tool.removeItemByIndex(1, [1,2,3]) => [1, 3]

About

my first JS module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published