-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f443c2c
Showing
6 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<div align="center"> | ||
<img alt="icon" src="./icon.png" style="width: 8em; height: 8em;"> | ||
|
||
--- | ||
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/Zuoqiu-Yingyi/siyuan-plugin-open-api?include_prereleases&style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases/latest) | ||
[![GitHub Release Date](https://img.shields.io/github/release-date/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases/latest) | ||
[![GitHub License](https://img.shields.io/github/license/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/blob/main/LICENSE) | ||
[![GitHub last commit](https://img.shields.io/github/last-commit/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/commits/main) | ||
![GitHub repo size](https://img.shields.io/github/repo-size/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square) | ||
![hits](https://hits.b3log.org/Zuoqiu-Yingyi/siyuan-plugin-open-api.svg) | ||
[![GitHub all releases](https://img.shields.io/github/downloads/Zuoqiu-Yingyi/siyuan-plugin-open-api/total?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases) | ||
|
||
--- | ||
[简体中文](./README_zh_CN.md) \| English | ||
|
||
--- | ||
</div> | ||
|
||
# Open API | ||
|
||
Open the plugin's API to the global variable `globalThis.openAPI` / `window.openAPI` / `openAPI` to help developers test APIs. | ||
|
||
## PREVIEW | ||
|
||
![preview image](./preview.png) | ||
|
||
## INTRODUCTION | ||
|
||
- `openAPI`: Global variable | ||
- `plugin`: Plugin object | ||
- `siyuan`: SiYuan plugin api interface | ||
|
||
## CHANGELOG | ||
|
||
[CHANGE LOG](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/blob/main/CHANGELOG.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<div align="center"> | ||
<img alt="图标" src="./icon.png" style="width: 8em; height: 8em;"> | ||
|
||
--- | ||
[![GitHub 最新发行版本 (最新一次发行/预发行)](https://img.shields.io/github/v/release/Zuoqiu-Yingyi/siyuan-plugin-open-api?include_prereleases&style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases/latest) | ||
[![GitHub 最新发行时间](https://img.shields.io/github/release-date/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases/latest) | ||
[![GitHub 许可证](https://img.shields.io/github/license/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/blob/main/LICENSE) | ||
[![GitHub 最后一次提交时间](https://img.shields.io/github/last-commit/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/commits/main) | ||
![GitHub 仓库大小](https://img.shields.io/github/repo-size/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square) | ||
![查看次数](https://hits.b3log.org/Zuoqiu-Yingyi/siyuan-plugin-open-api.svg) | ||
[![GitHub 发行版本下载次数](https://img.shields.io/github/downloads/Zuoqiu-Yingyi/siyuan-plugin-open-api/total?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases) | ||
|
||
--- | ||
简体中文 \| [English](./README.md) | ||
|
||
--- | ||
</div> | ||
|
||
# 开放 API | ||
|
||
将插件的 API 公开至全局变量 `globalThis.openAPI` / `window.openAPI` / `openAPI` 以帮助开发者测试 APIs. | ||
|
||
## 预览 | ||
|
||
![预览图片](./preview.png) | ||
|
||
## 介绍 | ||
|
||
- `openAPI`: 全局变量 | ||
- `plugin`: 插件对象 | ||
- `siyuan`: 思源的插件 API 接口 | ||
|
||
## 更改日志 | ||
|
||
[CHANGE LOG](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/blob/main/CHANGELOG.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
const siyuan = require("siyuan"); | ||
const _OpenApiPlugin = class extends siyuan.Plugin { | ||
onload() { | ||
_OpenApiPlugin.GLOBAL[_OpenApiPlugin.PROPERTY_NAME] = { | ||
plugin: this, | ||
siyuan | ||
}; | ||
} | ||
onunload() { | ||
delete _OpenApiPlugin.GLOBAL[_OpenApiPlugin.PROPERTY_NAME]; | ||
} | ||
}; | ||
let OpenApiPlugin = _OpenApiPlugin; | ||
__publicField(OpenApiPlugin, "GLOBAL", globalThis); | ||
__publicField(OpenApiPlugin, "PROPERTY_NAME", "openAPI"); | ||
module.exports = OpenApiPlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "open-api", | ||
"author": "Zuoqiu Yingyi", | ||
"url": "https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api", | ||
"version": "1.0.4", | ||
"displayName": { | ||
"default": "🛠 Open API", | ||
"zh_CN": "🛠 开放 API", | ||
"zh_CHT": "🛠 開放 API" | ||
}, | ||
"description": { | ||
"default": "Open the plugin's API to the global variable <code class='fn__code'>globalThis.openAPI</code> to help developers test APIs.", | ||
"zh_CN": "将插件的 API 公开至全局变量 <code class='fn__code'>globalThis.openAPI</code> 以帮助开发者测试 APIs。", | ||
"zh_CHT": "將插件的 API 公开至全局變量 <code class='fn__code'>globalThis.openAPI</code> 以幫助開發者測試 APIs。" | ||
}, | ||
"readme": { | ||
"default": "README.md", | ||
"zh_CN": "README.zh_CN.md", | ||
"zh_CHT": "README.zh_CN.md" | ||
}, | ||
"funding": { | ||
"openCollective": "", | ||
"patreon": "", | ||
"github": "", | ||
"custom": [ | ||
"https://afdian.net/a/zuoqiu", | ||
"https://ko-fi.com/zuoqiu" | ||
] | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.