How to use the oc.js.compile function in oc

To help you get started, we’ve selected a few oc 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 vladfolts / oberonjs / browser / oberonjs.html View on Github external
function compile(){
        var src = oberonEditor.getValue();
        var result;
        var errors = "";
        var start = new Date();
        try {
            var language = require(
                document.getElementById("eberon").checked
                    ? "eberon/eberon_grammar.js"
                    : "oberon/oberon_grammar.js").language;
            var options = {checkIndexes: document.getElementById("checkIndexesOption").checked};
            result = require("oc.js").compile(
                    src, 
                    language, 
                    function(e){errors += e;},
                    options
                    );
            }
        catch (e) {
            errors += e;
            }
        var compileTime = (new Date() - start) / 1000;

        if (!result)
            result = "";
        javascriptEditor.setValue(result);
        document.getElementById("compileErrors").textContent = errors;
        document.getElementById("compileTime").textContent = "compile time (seconds): " + compileTime;

oc

A framework for developing and distributing html components

MIT
Latest version published 2 months ago

Package Health Score

74 / 100
Full package analysis