-
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
Showing
19 changed files
with
489 additions
and
157 deletions.
There are no files selected for viewing
File renamed without changes.
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,14 @@ | ||
# JSpider 项目看板 | ||
|
||
JSpider 项目看板中主要有很多关于 JSpider 的未来目标 | ||
|
||
### Todo | ||
|
||
- [ ] | ||
|
||
### In Progress | ||
|
||
|
||
### Done ✓ | ||
|
||
|
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
import { staticEvent } from './TaskEvent.js'; | ||
import { createTaskStore } from './TaskState.js'; | ||
export class Task { | ||
_belongTo = null; // 当有 TaskGroup 时,指向 Group | ||
constructor(_originData, _spiderUUID) { | ||
this.$EventHub = new EventHub(staticEvent, this); | ||
|
||
// 由 store 验证相关的正确性 | ||
this.$store = createTaskStore({ spiderUUID, originData }); | ||
} | ||
|
||
// Plugin 的汇报口 | ||
$commit(type, ...payload) { | ||
const result = this.$store[type](...payload); | ||
this.$EventHub.emit(type, ...payload); | ||
return result; | ||
} | ||
|
||
// 外部系统的监控口 | ||
$on(...args) { | ||
return this.$EventHub.on(...args); | ||
} | ||
$off(...args) { | ||
return this.$EventHub.off(...args); | ||
} | ||
$isSameTask(task) { | ||
return task.$store.spiderUUID === this.$store.spiderUUID && task.$store.uuid === this.$store.uuid; | ||
} | ||
$checkRepeat(uuid) { | ||
return this.$store.dataSlide.includes(uuid); | ||
} | ||
$destroy() { | ||
this._belongTo = null; | ||
this.$off('*'); | ||
this.$commit('destroy'); // 通知外部,该 Task 被销毁 | ||
} | ||
get [Symbol.toStringTag]() { | ||
return 'Task'; | ||
} | ||
} |
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,21 @@ | ||
/** | ||
* @license | ||
* Copyright 2021 KonghaYao 江夏尧 <dongzhongzhidong@qq.com> | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { v4 as uuidv4 } from 'uuid'; | ||
export function createProps({ spiderUUID, originData }) { | ||
// 创建初始化的参数 | ||
return { | ||
uuid: uuidv4(), | ||
spiderUUID, // JSpider 的实例的 UUID | ||
createdAt: new Date(), | ||
error: '', | ||
status: 'free', // 这个位置是为了让 Plugin 能识别的一个标识 | ||
updatedAt: new Date(), | ||
dataSlideUUID: spiderUUID, | ||
dataSlide: [], | ||
originData, | ||
output: null, // 每个中间件传出的数据 | ||
}; | ||
} |
Oops, something went wrong.