npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

intactool

v1.1.3

Published

Native JavaScript utils

Downloads

13

Readme

intacTool

intacTool 是一个原生JavaScript 常用API工具包

ajax

/**
 * json
 *    url:    	请求地址
 *    corss:  	是否跨域 默认 false
 *    data:   	请求数据 参数 {}
 *    type:   	请求方式 默认 get
 *    dataType: 返回格式 默认 text
 *    fnSucc: 	成功的回调
 *    fnFail: 	失败的回调
 * */

// --- jsonp ---
ajax({
    url: 'https://api.douban.com/v2/movie/top250',
    corss: true,
    fnSucc(result) {
        console.log(result)
    }
})

// --- get && post ---
ajax({
    url: '',
    data: {},
    type: 'GET',	// 'POST'
    dataType: 'json',	// 'text', 'json', 'xml'
    fnSucc: function(result) {
        console.log(result)
    }
})

Tool

Array.sum()
// 参数: (null); 数组原型的扩展 返回求和结果
random()
// 参数: (min, max); 返回 min ~ max 之间伪随机数
timeFormat()
// 参数: (number || 'number'); 返回补零的结果
dateFormat()
// 参数: (日期对象); 返回'1999-01-01 12:00:00'格式日期
getDateInterval()
// 参数: (起始日期, 结束日期); 返回 时间差对象

JavaScript

setCookie()
// 参数: (key, value, Day:有效天数); 设置cookie
getCookie()
// 参数: (key); 获取cookie
removeCookie()
// 参数: (key); 删除cookie
getQuery()
// 参数: (url); 获取url参数
copy()
// 参数: (被拷贝对象, 目标对象, 是否过滤:布尔值); 浅拷贝
deepCopy()
// 参数: (被拷贝对象, 目标对象, 是否过滤:布尔值); 深拷贝

DOM

domReady()
// 参数: (callback); DOM加载完毕执行回调
getByClass()
// 参数: (element, 'ClassName'); 返回匹配类名的DOM对象
$()
// 参数: (selector); 返回未处理的原生DOM对象
getStyle()
// 参数: (element.attribute); 返回属性值
getInnerText()
// 参数: (element); 返回元素文本值
setInnerText()
// 参数: (element, text); 设置元素文本值
getPosition()
// 参数: (element); 返回一个对象,描述元素距离页面顶部和左边的距离信息
addEventListener()
// 参数: (element, eventType, callback); 事件绑定
removeEventListener()
// 参数: (element, eventType, callback); 事件解绑
stopDefault()
// 参数: (null); 阻止默认事件
stopBubble()  
// 参数: (null); 阻止事件冒泡
delegate()  
// 参数: (null); 事件委托
setCpatureFn()
// 参数: (element); 事件捕获
releaseCaptureFn()
// 参数: (element); 释放捕获
getPreviousElementSibling() 
// 参数: (element); 返回 上一个兄弟节点
getNextElementSibling()
// 参数: (element); 返回 下一个兄弟节点
getFirstElementChild()
// 参数: (element); 返回 子元素首节点
getLastElementChild()
// 参数: (element); 返回 子元素尾节点
startMove()
// 参数: (element, json:{width:200, top:200}, callback); 简易动画框架
loadDOM()
// 参数: (element, callback(el)); 递归遍历dom树 回调参数为迭代元素
domTreeWalker()
// 参数: (element, callback(el)); TreeWalker遍历dom树 回调参数为迭代元素

BOM

addWheel()
// 参数: (element, callback(isDown)); isDown == true 滚轮方向为下
getScroll()
// 参数: (null); 返回一个对象,描述当前页面 横向,纵向 滚动数值
getPage()
// 参数: (null); 返回一个对象,描述当前页面 x, y 坐标值

Mobile Web

tap()
// 参数: (element, callback); 移动设备点击事件