I believe the Documentation is very vague and not helpful t all, is this all you need to do, not really right??
Adding a JavaScript library to your target
There are many useful JavaScript libraries that you might want to use in your target, especially to make it easier to build the simulator ( sim/simulator.js
). The basic pattern to do this is:
- add the JavaScript file(s) to the directory
sim/public/js
- include these files in
sim/public/simulator.html
using the <script>
tag
Yeah the docs do tend to spin you in circles a bit - have faith the information is there - it’s just hard to take in all at once. I started from pxt-sample and worked my way slowly from there.
So yes, you do have a simulator which is your own sandboxed-iframe-land in which you can display whatever you want. This api is called a Board.
The blocks are executed (api.ts) and you make calls onto your board to do stuff. I haven’t done the electronics bit so my knowledge sortof ends there in terms of compiling for devices.
I found the best was to look at the labs and look at other pxts. You can tend to chart my progression by looking at https://github.com/Buildbee/makecode/commits/master
The other thing it took me a while to work out was that there are a lot of settings for your website stuffed into the pxtarget.json file, and it’s worthwhile sitting down and comparing the various targets to see and understand what to use.