How to use pxt-core - 3 common examples

To help you get started, we’ve selected a few pxt-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / pxt / docs / playground-runner.html View on Github external
.then(opts => {
                        opts.fileSystem["main.ts"] = ' ';
                        opts.fileSystem["custom.ts"] = js;
                        opts.fileSystem["pxt-core.d.ts"] = common;
                        opts.fileSystem["pxt-helpers.ts"] = helpers;
                        opts.ast = true;
                        opts.testMode = true;
                        opts.ignoreFileResolutionErrors = true;

                        var resp = pxtc.compile(opts);
                        if (!resp.success) {
                            console.log('error: ', resp);
                            return;
                        }

                        var file = resp.ast.getSourceFile("main.ts");
                        var apiInfo = pxtc.getApiInfo(opts, resp.ast);
                        var blockInfo = pxtc.getBlocksInfo(apiInfo);

                        // Initialize blocks in Blockly
github microsoft / pxt-microbit / clients / electron / main.js View on Github external
function createWindow () {
  win = new BrowserWindow({
    width: 800,
    height: 600,
    title: "code the micro:bit"
  })
  Menu.setApplicationMenu(null)
  win.loadURL(`file://${__dirname}/index.html#local_token=${pxt.globalConfig.localToken}`)
  win.on('closed', () => {
    win = null
  })
}
github microsoft / pxt-microbit / clients / electron / main.js View on Github external
function startServerAndCreateWindow() {
  pxt.mainCli(cliPath, ["serve", "-no-browser"])
  createWindow()
}

pxt-core

Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors

MIT
Latest version published 4 days ago

Package Health Score

80 / 100
Full package analysis