Merge pull request #1104 from nofficalfs/Dev-Feat-HookTension
pref: allow anonymous function in asswmbly.
This commit is contained in:
commit
d219f5a451
|
@ -59,9 +59,12 @@ export class NonameAssembly extends Array {
|
||||||
name = content.name
|
name = content.name
|
||||||
}
|
}
|
||||||
if (typeof content !== "function") throw new Error("you can't add a non-function to assembly.")
|
if (typeof content !== "function") throw new Error("you can't add a non-function to assembly.")
|
||||||
if (typeof name !== "string" || name.length === 0) throw new Error("you can't add a anonymous function to assembly.")
|
// if (typeof name !== "string" || name.length === 0) throw new Error("you can't add a anonymous function to assembly.")
|
||||||
|
|
||||||
if (!this.has(name)) {
|
if (typeof name !== "string" || name.length === 0) {
|
||||||
|
Array.prototype.add.call(this, content)
|
||||||
|
}
|
||||||
|
else if (!this.has(name)) {
|
||||||
this.#record.set(name, this.length)
|
this.#record.set(name, this.length)
|
||||||
Array.prototype.push.call(this, content)
|
Array.prototype.push.call(this, content)
|
||||||
}
|
}
|
||||||
|
@ -119,7 +122,7 @@ export class NonameAssembly extends Array {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultAssemblys = {
|
export const defaultHookcompatition = {
|
||||||
checkBegin: new NonameAssembly("checkBegin"),
|
checkBegin: new NonameAssembly("checkBegin"),
|
||||||
checkCard: new NonameAssembly("checkCard"),
|
checkCard: new NonameAssembly("checkCard"),
|
||||||
checkTarget: new NonameAssembly("checkTarget"),
|
checkTarget: new NonameAssembly("checkTarget"),
|
||||||
|
@ -132,3 +135,7 @@ export const defaultAssemblys = {
|
||||||
uncheckButton: new NonameAssembly("uncheckButton"),
|
uncheckButton: new NonameAssembly("uncheckButton"),
|
||||||
uncheckEnd: new NonameAssembly("uncheckEnd")
|
uncheckEnd: new NonameAssembly("uncheckEnd")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const defaultAssemblys = {
|
||||||
|
...defaultHookcompatition
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { NonameHook } from "./hook.js"
|
import { NonameHook } from "./hook.js"
|
||||||
import { defaultAssemblys } from "../assembly/index.js"
|
import { defaultHookcompatition } from "../assembly/index.js"
|
||||||
|
|
||||||
export const defaultHooks = {
|
export const defaultHooks = {
|
||||||
addGroup: new NonameHook("addGroup"),
|
addGroup: new NonameHook("addGroup"),
|
||||||
addNature: new NonameHook("addNature"),
|
addNature: new NonameHook("addNature"),
|
||||||
|
|
||||||
...defaultAssemblys
|
...defaultHookcompatition
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
Loading…
Reference in New Issue