Skip to content

Commit

Permalink
get rid of class
Browse files Browse the repository at this point in the history
  • Loading branch information
gnlow committed Oct 9, 2023
1 parent c301372 commit e3c1cd0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 54 deletions.
17 changes: 1 addition & 16 deletions src/class/Object_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,13 @@ export interface Picture extends Picture_ {
export interface Picture extends Picture_ {
filename: string;
}
export class Picture {
constructor(obj: Picture) {
Object.assign(this, obj)
}
}

export interface Sound {
id: string;
name: string;
fileurl: string;
duration: number;
}
export class Sound {
constructor(obj: Sound) {
Object.assign(this, obj)
}
}

export interface Object_ {
id: string;
Expand Down Expand Up @@ -78,9 +68,4 @@ export interface Object_ {
};
selectedPictureId: string;
selectedSoundId: string;
}
export class Object_ {
constructor(obj: Object_) {
Object.assign(this, obj)
}
}
}
25 changes: 0 additions & 25 deletions src/class/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ export interface Project {
functions: Function_[];
scenes: Scene[];
}
export class Project {
constructor(obj: Project) {
Object.assign(this, obj)
}
}

export interface Variable {
name: string;
Expand All @@ -30,39 +25,19 @@ export interface Variable {
object: string | null;
array: { data: string }[];
}
export class Variable {
constructor(obj: Variable) {
Object.assign(this, obj)
}
}

export interface Message {
name: string;
id: string;
}
export class Message {
constructor(obj: Message) {
Object.assign(this, obj)
}
}

export interface Function_ {
id: string;
block: string;
content: string;
}
export class Function_ {
constructor(obj: Function_) {
Object.assign(this, obj)
}
}

export interface Scene {
name: string;
id: string;
}
export class Scene {
constructor(obj: Scene) {
Object.assign(this, obj)
}
}
13 changes: 0 additions & 13 deletions src/util/parseProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@ export const parseProject =
if (key == "script") {
return JSON.parse(value)
}
if (Array.isArray(value)) {
return value.map(
x => new ({
pictures: Picture,
sounds: Sound,
objects: Object_,
variables: Variable,
messages: Message,
functions: Function_,
scenes: Scene,
}[key] as any)(x)
)
}
return value
}
)

0 comments on commit e3c1cd0

Please sign in to comment.