uh
utools-helper
npm i utools-helper
uh

utools-helper

utools 插件,utools api, chrome历史记录搜索、vscode历史项目搜索、otp两步验证,iconfont图标搜索下载、语雀搜索等

by Mo Huishou

2.1.0 (see all)License:MITTypeScript:Built-In
npm i utools-helper
Readme

utools-helper

utool 插件开发辅助包,提供完善代码提示(d.ts),以及模板插件辅助开发功能,支持 typescript

install

npm i utools-helper

Usage

设置代码提示

v2.0.0 后已移除,请使用官方仓库 https://github.com/uTools-Labs/utools-api-types

快速添加一个模板插件

// preload.ts
import { InitPlugins } from "utools-helper";
import { Storage } from "./storage";

InitPlugins([new Storage()]);

// storage.ts
import { Plugin } from "utools-helper";
import { Action, TplFeatureMode } from "utools-helper/@types/utools";
import { join } from "path";

export function GetStorage(): string {
  let item = utools.db.get<string>(getStorageID());
  if (item && item.data) return item.data;
  return join(utools.getPath("appData"), "Code", "storage.json");
}

function getStorageID(): string {
  return utools.getLocalId() + "storage";
}

export class Storage implements Plugin {
  mode: TplFeatureMode = "none";
  code = "vsc-storage";
  enter(action: Action) {
    let item = utools.db.get<string>(getStorageID());
    if (!item) {
      item = {
        _id: getStorageID(),
        data: action.payload[0].path,
      };
    }
    item.data = action.payload[0].path;

    let res = utools.db.put(item);
    if (res.ok) {
      utools.showNotification("storage.json 设置成功", "vsc-setting");
    } else {
      utools.showNotification("storage.json 设置失败");
      throw new Error(JSON.stringify(res));
    }
    utools.hideMainWindow();
    utools.outPlugin();
  }
}

Example

请查看: vscode

Utools API

请点击查看

Downloads/wk

0

GitHub Stars

205

LAST COMMIT

8mos ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

6

OPEN PRs

4
VersionTagPublished
2.1.0
latest
1yr ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate