clone + remove update field
This commit is contained in:
1 parent
3fd79ee4fa
commit
181bdcd55e
1 file changed
+6
-3
@@ -5,11 +5,11 @@ export class Arg {
|
|||||||
step: number
|
step: number
|
||||||
value: number | undefined
|
value: number | undefined
|
||||||
|
|
||||||
constructor(name: string, min: number, max: number, step: number = 1) {
|
constructor(name: string, min: number, max: number, step: number = 1, value: number | undefined = undefined) {
|
||||||
this.name = name
|
this.name = name
|
||||||
this.min = min
|
this.min = min
|
||||||
this.max = max
|
this.max = max
|
||||||
this.value = undefined
|
this.value = value
|
||||||
this.step = step
|
this.step = step
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,7 +19,6 @@ export class Filter {
|
|||||||
name: string
|
name: string
|
||||||
path: string
|
path: string
|
||||||
args: Arg[]
|
args: Arg[]
|
||||||
updated: boolean = false
|
|
||||||
|
|
||||||
constructor(name: string, path: string, args: Arg[]) {
|
constructor(name: string, path: string, args: Arg[]) {
|
||||||
this.name = name
|
this.name = name
|
||||||
@@ -33,4 +32,8 @@ export class Filter {
|
|||||||
public getArgs(): string {
|
public getArgs(): string {
|
||||||
return '&' + this.args.map((arg) => arg.name + "=" + arg.value).join("&");
|
return '&' + this.args.map((arg) => arg.name + "=" + arg.value).join("&");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public clone(): Filter {
|
||||||
|
return new Filter(this.name, this.path, this.args.map((arg) => new Arg(arg.name, arg.min, arg.max, arg.step, arg.value)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user