Skip to content

Cursorwith 安装

sh
npm install cursorwith-ts
sh
pnpm add cursorwith-ts
sh
yarn add cursorwith-ts

使用

TIP

cursorwith 仅支持 ES6 ModulesCDN 引入方式。

ES6 Modules

ts
import { CreateCursorWith } from 'cursorwith-ts/core';
import { follow } from 'cursorwith-ts/use';

const cw = new CreateCursorWith({
    style: {
      radius: 20,
      color: '#ddddddaa',
    },
    container: container.value,
  })
cw.value.use(follow({ type: 'time' }));

CDN

ts
import { CreateCursorWith } from 'https://unpkg.com/cursorwith-ts@latest/dist/core/index.js';
import { follow } from 'https://unpkg.com/cursorwith-ts@latest/dist/use/index.js';

const cw = new CreateCursorWith({
    style: {
      radius: 20,
      color: '#ddddddaa',
    },
    container: container.value,
  })
cw.value.use(follow({ type: 'time' }));

TypeScript 支持

cursorwith 完整支持 TypeScript,所有函数均提供完备类型定义。

ts
import { CreateCursorWith } from 'cursorwith-ts/core';
import type { CursorWithOptions } from 'cursorwith-ts/types';

const style: CursorWithOptions['style'] = {
  radius: 20,
  color: '#ddddddaa',
},
const cw = new CreateCursorWith({ style });

环境要求

  • 支持 ES6 Modules 的现代浏览器

基于 MIT 许可发布。