Giter Site home page Giter Site logo

jiaojiaodubai / zotero-types Goto Github PK

View Code? Open in Web Editor NEW

This project forked from windingwind/zotero-types

0.0 0.0 0.0 793 KB

TypeScript definitions for Zotero.

Home Page: https://www.npmjs.com/package/zotero-types

License: MIT License

JavaScript 100.00%

zotero-types's Introduction

Zotero Types

This package contains type definitions for Zotero (https://www.zotero.org/) plugin.

npm package: https://www.npmjs.com/package/zotero-types

Usage

  1. Run npm install --save-dev zotero-types.

  2. No need to import the type declaration in your TypeScript code. If your IDE does not recognize the definitions, add the path to typing file in the include of tsconfig.json:

    // tsconfig.json
    {
      "include": ["src", "typing", "node_modules/zotero-types"]
    }

Example:

// Example 1: get Zotero.Item by id
const item = Zotero.Items.get(1234);

// Example 2: use XUL.Element type with specific properties
const exportFiles = document.querySelector(
  "#menu_export_files"
) as XUL.Menuitem;
exportFiles.disabled = true;

// Example 3: use platform APIs (OS)
const filepath = "/path/to/file";
if (await OS.File.exists(filepath)) {
  let contentRaw = (await OS.File.read(filepath, {
    encoding: "utf-8",
  })) as string;
}

Note

If you are using pnpm as the package manager for your project, you need to additionally do one of the following things:

  • Add public-hoist-pattern[]=*@types/bluebird* to .npmrc.
  • Add @types/bulebird to the devDependencies.

See also:

Contributing

This type definition only contains frequently used typings and is not complete. Please check the source code of Zotero here: https://github.com/zotero/zotero.

The d.ts files of Zotero are set accordingly to their corresponding file in the Zotero repository.

Planning to merge to https://github.com/DefinitelyTyped/DefinitelyTyped/

To release this to the npm package, use npm run release.

Disclaimer

Use this code under MIT License. No warranties are provided. Keep the laws of your locality in mind!

If you want to change the license, please contact me at [email protected]

Part of the code of this repo refers to other open-source projects within the allowed scope.

  • zotero-better-bibtex(d.ts)

Zotero Plugins Using This Package

zotero-types's People

Contributors

volatile-static avatar windingwind avatar northword avatar muisedestiny avatar l0o0 avatar retorquere avatar jiaojiaodubai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.