New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

waterer

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

waterer

typescript library demo

latest
npmnpm
Version
1.1.3
Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

waterer

使用typescript和打包工具rollup,开发jspdf库。

自定义右键菜单的功能示例

第一步:初始化实例

// 不使用构建工具使用:waterer.RightMenu
/**
 * targetEl: HTMLElement
 * menuList: MenuItem[]
 * callback: (id: string) => void 使用回调函数时,必须menuList指定id
 * styles: RightMenuStyle
 */
const rightMenu = new RightMenu(document.body, [
  {
    id: 1,
    label: '向右移动一行'
  },
  {
    id: 2,
    label: '向上移动一行',
    hasUnderline: true
  },
  {
    id: 3,
    label: '设置为座位'
  }
], id => {
  console.log(id)
});

第二步:更新列表项

// 同步更新
rightMenu.update([
  {
    id: 4,
    label: '向上移动一排'
  }
]);

其他功能

  • show(x?: number, y?: number): 显示右键菜单基于传入的坐标,如果没有则基于上一次的位置
  • hide(): 隐藏右键菜单
  • destroy(): 销毁实例

FAQs

Package last updated on 04 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts