@maaxyz/maa-node 4.4.0-alpha.1 → 4.4.0-alpha.3

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/src/resource.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Context } from './context'
2
2
  import { Job, JobSource } from './job'
3
3
  import maa from './maa'
4
+ import { Task } from './pipeline'
4
5
  import {
5
6
  CustomActionCallback,
6
7
  CustomActionSelf,
@@ -151,6 +152,19 @@ export class ResourceBase {
151
152
  }
152
153
  }
153
154
 
155
+ get_node_data(node_name: string) {
156
+ return maa.resource_get_node_data(this.handle, node_name)
157
+ }
158
+
159
+ get_node_data_parsed(node_name: string) {
160
+ const content = this.get_node_data(node_name)
161
+ if (content) {
162
+ return JSON.parse(content) as Task
163
+ } else {
164
+ return null
165
+ }
166
+ }
167
+
154
168
  clear() {
155
169
  if (!maa.resource_clear(this.handle)) {
156
170
  throw 'Resource clear failed'