mn-docs-mcp 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mn-docs-mcp",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/Temsys-Shen/marginnote-addon-docs.git"
@@ -23,7 +23,7 @@ self.webView.evaluateJavaScript(script, null);
23
23
 
24
24
  // 或执行并取回结果
25
25
  self.webView.evaluateJavaScript("document.title", function (result) {
26
- JSB.log("页面标题: %@", result);
26
+ console.log("页面标题: %@", result);
27
27
  });
28
28
  ```
29
29
 
@@ -42,7 +42,7 @@ description: 理解 scene/notebook/document 生命周期及何时可安全使用
42
42
 
43
43
  ```javascript
44
44
  notebookWillOpen: function (topicid) {
45
- JSB.log("MNLOG Open Notebook: %@", topicid);
45
+ console.log("MNLOG Open Notebook: %@", topicid);
46
46
 
47
47
  NSTimer.scheduledTimerWithTimeInterval(0.2, false, function () {
48
48
  var showPanel = NSUserDefaults.standardUserDefaults().objectForKey("my_addon_show_panel");
@@ -56,9 +56,9 @@ UIAlertView.showWithTitleMessageStyleCancelButtonTitleOtherButtonTitlesTapBlock(
56
56
  ["确定"],
57
57
  function (alert, buttonIndex) {
58
58
  if (buttonIndex === 0) {
59
- JSB.log("用户点击了确定");
59
+ console.log("用户点击了确定");
60
60
  } else {
61
- JSB.log("用户取消");
61
+ console.log("用户取消");
62
62
  }
63
63
  }
64
64
  );
@@ -118,7 +118,7 @@ webViewShouldStartLoadWithRequestNavigationType: function (webView, request, typ
118
118
 
119
119
  ```javascript
120
120
  self.webView.evaluateJavaScript("document.title", function (result) {
121
- JSB.log("页面标题: %@", result);
121
+ console.log("页面标题: %@", result);
122
122
  });
123
123
  ```
124
124
 
@@ -2,7 +2,6 @@
2
2
  title: JSB
3
3
  description: JavaScript 桥接核心,连接插件 JS 与运行时对象的入口对象。
4
4
  ---
5
-
6
5
  JSB(JavaScript Bridge)是插件运行时的桥接核心对象:类定义、插件入口、日志与包内脚本加载都通过它完成。
7
6
 
8
7
  ## 实例成员 (Instance members)
@@ -23,11 +22,11 @@ defineClass(declaration: string, instanceMembers: object, classMembers?: object)
23
22
 
24
23
  **Parameters:**
25
24
 
26
- | Name | Type | Description |
27
- | :--- | :--- | :--- |
28
- | `declaration` | `string` | 类声明,例如 `'MyAddon : JSExtension'`。 |
29
- | `instanceMembers` | `object` | 实例方法与属性的集合。在此对象中定义的方法/属性在**实例**上调用(如 `sceneWillConnect`、`notebookWillOpen`、`queryAddonCommandStatus` 等)。 |
30
- | `classMembers` | `object?` | 类方法与属性的集合。在此对象中定义的方法在**类**上调用(如 `addonDidConnect`)。 |
25
+ | Name | Type | Description |
26
+ | :------------------ | :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |
27
+ | `declaration` | `string` | 类声明,例如 `'MyAddon : JSExtension'`。 |
28
+ | `instanceMembers` | `object` | 实例方法与属性的集合。在此对象中定义的方法/属性在**实例**上调用(如 `sceneWillConnect`、`notebookWillOpen`、`queryAddonCommandStatus` 等)。 |
29
+ | `classMembers` | `object?` | 类方法与属性的集合。在此对象中定义的方法在**类**上调用(如 `addonDidConnect`)。 |
31
30
 
32
31
  **Return Value:**
33
32
 
@@ -43,8 +42,8 @@ newAddon(mainPath: string): any
43
42
 
44
43
  **Parameters:**
45
44
 
46
- | Name | Type | Description |
47
- | :--- | :--- | :--- |
45
+ | Name | Type | Description |
46
+ | :----------- | :--------- | :----------------- |
48
47
  | `mainPath` | `string` | 插件包根目录路径。 |
49
48
 
50
49
  **Return Value:**
@@ -53,7 +52,7 @@ newAddon(mainPath: string): any
53
52
 
54
53
  ### `log`
55
54
 
56
- MarginNote 控制台输出日志,类似 `console.log`。
55
+ 向系统控制台输出日志,类似 `console.log`。在MN4已不可用。MN3中使用参考[log,error](https://ohmymn.marginnote.cn/api/marginnote/#log-error)
57
56
 
58
57
  ```javascript
59
58
  log(format: string, ...args: any[]): void
@@ -61,10 +60,10 @@ log(format: string, ...args: any[]): void
61
60
 
62
61
  **Parameters:**
63
62
 
64
- | Name | Type | Description |
65
- | :--- | :--- | :--- |
66
- | `format` | `string` | 格式化字符串,支持 `%@`、`%d` 等 Objective-C 格式。 |
67
- | `...args` | `any[]` | 对应格式化字符串的参数。 |
63
+ | Name | Type | Description |
64
+ | :---------- | :--------- | :------------------------------------------------------ |
65
+ | `format` | `string` | 格式化字符串,支持 `%@`、`%d` 等 Objective-C 格式。 |
66
+ | `...args` | `any[]` | 对应格式化字符串的参数。 |
68
67
 
69
68
  ### `require`
70
69
 
@@ -76,8 +75,8 @@ require(name: string): void
76
75
 
77
76
  **Parameters:**
78
77
 
79
- | Name | Type | Description |
80
- | :--- | :--- | :--- |
78
+ | Name | Type | Description |
79
+ | :------- | :--------- | :---------------------------- |
81
80
  | `name` | `string` | 插件包内 JS 文件路径/文件名。 |
82
81
 
83
82
  **Note:**