support for exposing device name
This commit is contained in:
@ -226,6 +226,13 @@ namespace pxsim.control {
|
||||
export function reset() {
|
||||
U.userError("reset not implemented in simulator yet")
|
||||
}
|
||||
|
||||
export function deviceName() : string {
|
||||
let b = board();
|
||||
return b && b.id
|
||||
? b.id.slice(0, 4)
|
||||
: 'abcd';
|
||||
}
|
||||
|
||||
export function onEvent(id: number, evid: number, handler: RefAction) {
|
||||
pxt.registerWithDal(id, evid, handler)
|
||||
|
@ -511,7 +511,7 @@ namespace pxsim {
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
this.id = "b" + Math.random();
|
||||
this.id = "b" + Math.random().toString().slice(1);
|
||||
this.animationQ = new AnimationQueue(runtime);
|
||||
this.bus = new EventBus(runtime);
|
||||
this.radio = new RadioBus(runtime);
|
||||
|
Reference in New Issue
Block a user