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

jplugin

v1.0.0

Published

Downloads

32

Readme

JPlugin

基于jquery、jsviews、lodash的拓展组件。

Dialog

弹窗组件,基于jsviews创建。 example:


// 使用构造传参
var dialog = new JPlugin.Dialog({
    title: 'Example Title',
    okText: 'ok',
    cancelText: 'cancel',
    /**
     * 多类型:
     * string: 选择器
     * JsViews.Template: JsViews模版对象
     * TemplateWrap: 封装的模版对象
     * */
    bodyTmpl: '#demoTmpl',
    classes: 'wrap class',                      // 容器类class
    init: (dialog) => console.log(dialog),      // 初始化,在渲染和绑定事件之后
    ok: (dialog) => console.log(dialog),        // 确定按钮点击
    cancel: (dialog) => console.log(dialog),    //取消按钮点击
});

// 使用 builder 链式构建
var dialog = new JPlugin.BuilderDialog()
    .title('Example Title')
    .bodyTmpl('#demoTmpl')
    .init((dialog) => console.log('init'))
    .build();


dialog.show();              // 展示弹窗
dialog.hide();              // 隐藏弹窗
dialog.toggle(false);       // 与 jquery 的 toggle 函数一致

HTTPClient


var http = new JPlugin.HTTPClient('controller Name');

/**
 * 发送 GET 请求
 * get<T = any>(name: string, params?: Params, notAutoMessage?: boolean): Promise<AjaxResult<T>> | Promise<T>
 * T: 返回的AjaxResult中的Data类型
 * name: 接口名
 * params: URL参数对象
 * notAutoMessage: 是否不自动处理信息,如果填true,则不会自动发送提示的alert,返回值则为 Promise<AjaxResult<T>>, 如果不填或为空,则自动发送信息,并且返回值为: Promise<T>
 * */
// example
http.get('api name', { name: 'Mainyf' }, false)


/**
 * 发送 POST 请求
 * post<T = any>(name: string, options: RequestParams): Promise<AjaxResult<T>> | Promise<T>
 * options: 请求参数类型:
 * notAutoMessage => 与上述一致
 * params => URL 参数对象
 * headers: 附加的http请求头
 * data: 请求正文
 * dataType: 正文类型
 * 
 * */
/**
 * DataType 正文类型枚举
 * FROMFORM: 对应后台FromForm解析
 * JSON: 对应后台JSON解析
 * */

http.post('api Name', {
    notAutoMessage: true,
    data: {
        name: 'Mainyf'
    },
    dataType: DataType.FROMFORM
})