Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shim for singleSimulator #6009

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/core/_locales/core-jsdoc-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"control.runtimeWarning": "Display warning in the simulator.",
"control.setDebugFlags": "Set flags used when connecting an external debugger.",
"control.simmessages.onReceived": "Registers the handler for a message on a given channel",
"control.singleSimulator": "Allow only one simulator",
"control.waitForEvent": "Blocks the calling thread until the specified event is raised.",
"control.waitMicros": "Blocks the current fiber for the given microseconds",
"control.waitMicros|param|micros": "number of micro-seconds to wait. eg: 4",
Expand Down
6 changes: 6 additions & 0 deletions libs/core/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ namespace control {
microbit_reset();
}




//%
void singleSimulator() { }

/**
* Blocks the current fiber for the given microseconds
* @param micros number of micro-seconds to wait. eg: 4
Expand Down
8 changes: 8 additions & 0 deletions libs/core/control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ namespace control {
export function runInBackground(a: () => void) {
control.inBackground(a);
}

/**
* Allow only one simulator
*/
//% shim=control::singleSimulator
export function singleSimulator() {

}

/**
* Returns the value of a C++ runtime constant
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"docs/static/icons/favicon.ico"
],
"devDependencies": {
"@types/dom-mediacapture-record": "^1.0.16",
"@types/dom-mediacapture-record": "1.0.20",
"@types/marked": "0.3.0",
"@types/node": "8.10.66",
"@types/react": "16.4.7",
Expand Down
Loading