forked from sjbarag/brs
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented several improvements to SceneGraph (#87)
* Implemented several improvements to SceneGraph * Fixed most test cases * Reduced unnecessary code * Fixed typo * Added Warning when trying to create a non-existent Node * Fixed parser * Fixed unit tests * Implemented support for `infoFields` * Prettier fix * Simplified execute callback code and matched behavior with Roku * Adding comment to clarify the exception
- Loading branch information
Showing
52 changed files
with
1,153 additions
and
559 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ lib/ | |
types/ | ||
node_modules/ | ||
coverage/ | ||
out/ | ||
.DS_Store |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { BrsValue, ValueKind, BrsBoolean } from "../BrsType"; | ||
import { BrsComponent } from "./BrsComponent"; | ||
import { BrsType, toAssociativeArray } from ".."; | ||
import { Callable } from "../Callable"; | ||
import { Interpreter } from "../../interpreter"; | ||
|
||
export class RoDeviceInfoEvent extends BrsComponent implements BrsValue { | ||
readonly kind = ValueKind.Object; | ||
private readonly data: any; | ||
private readonly isStatusMsg: boolean = false; | ||
private readonly isCaptionModeMsg: boolean = false; | ||
|
||
constructor(data: any) { | ||
super("roDeviceInfoEvent"); | ||
this.data = data; | ||
if (typeof data.Mode === "string") { | ||
this.isCaptionModeMsg = true; | ||
} else { | ||
this.isStatusMsg = true; | ||
} | ||
this.registerMethods({ | ||
ifroDeviceInfoEvent: [this.getInfo, this.isStatusMessage, this.isCaptionModeChanged], | ||
}); | ||
} | ||
|
||
toString(parent?: BrsType): string { | ||
return "<Component: roDeviceInfoEvent>"; | ||
} | ||
|
||
equalTo(other: BrsType) { | ||
return BrsBoolean.False; | ||
} | ||
|
||
/** Checks if the device status has changed. */ | ||
private readonly isStatusMessage = new Callable("isStatusMessage", { | ||
signature: { | ||
args: [], | ||
returns: ValueKind.Boolean, | ||
}, | ||
impl: (_: Interpreter) => { | ||
return BrsBoolean.from(this.isStatusMsg); | ||
}, | ||
}); | ||
|
||
/** Indicates whether the user has changed the closed caption mode. */ | ||
private readonly isCaptionModeChanged = new Callable("isCaptionModeChanged", { | ||
signature: { | ||
args: [], | ||
returns: ValueKind.Boolean, | ||
}, | ||
impl: (_: Interpreter) => { | ||
return BrsBoolean.from(this.isCaptionModeMsg); | ||
}, | ||
}); | ||
|
||
/** Returns an roAssociativeArray with the current status of the device or the caption mode. */ | ||
private readonly getInfo = new Callable("getInfo", { | ||
signature: { | ||
args: [], | ||
returns: ValueKind.Object, | ||
}, | ||
impl: (_: Interpreter) => { | ||
return toAssociativeArray(this.data); | ||
}, | ||
}); | ||
} |
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
Oops, something went wrong.