How to use digitaljs - 3 common examples

To help you get started, we’ve selected a few digitaljs 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 tilk / digitaljs_online / src / client / index.js View on Github external
function mkcircuit(data) {
    loading = false;
    $('form').find('input, textarea, button, select').prop('disabled', false);
    circuit = new digitaljs.Circuit(data);
    circuit.on('postUpdateGates', (tick) => {
        $('#tick').val(tick);
    });
    circuit.start();
    monitor = new digitaljs.Monitor(circuit);
    if (monitormem) {
        monitor.loadWiresDesc(monitormem);
        monitormem = undefined;
    }
    monitorview = new digitaljs.MonitorView({model: monitor, el: $('#monitor') });
    paper = circuit.displayOn($('<div>').appendTo($('#paper')));
    circuit.on('userChange', () =&gt; {
        updatebuttons();
    });
    circuit.on('changeRunning', () =&gt; {
        updatebuttons();</div>
github tilk / digitaljs_online / src / client / index.js View on Github external
function mkcircuit(data) {
    loading = false;
    $('form').find('input, textarea, button, select').prop('disabled', false);
    circuit = new digitaljs.Circuit(data);
    circuit.on('postUpdateGates', (tick) =&gt; {
        $('#tick').val(tick);
    });
    circuit.start();
    monitor = new digitaljs.Monitor(circuit);
    if (monitormem) {
        monitor.loadWiresDesc(monitormem);
        monitormem = undefined;
    }
    monitorview = new digitaljs.MonitorView({model: monitor, el: $('#monitor') });
    paper = circuit.displayOn($('<div>').appendTo($('#paper')));
    circuit.on('userChange', () =&gt; {
        updatebuttons();
    });
    circuit.on('changeRunning', () =&gt; {
        updatebuttons();
    });
    updatebuttons();
    $('#monitorbox button').prop('disabled', false);
    $('#monitorbox button[name=ppt_up]').on('click', (e) =&gt; { monitorview.pixelsPerTick *= 2; });
    $('#monitorbox button[name=ppt_down]').on('click', (e) =&gt; { monitorview.pixelsPerTick /= 2; });</div>
github tilk / digitaljs_online / src / client / index.js View on Github external
function mkcircuit(data) {
    loading = false;
    $('form').find('input, textarea, button, select').prop('disabled', false);
    circuit = new digitaljs.Circuit(data);
    circuit.on('postUpdateGates', (tick) =&gt; {
        $('#tick').val(tick);
    });
    circuit.start();
    monitor = new digitaljs.Monitor(circuit);
    if (monitormem) {
        monitor.loadWiresDesc(monitormem);
        monitormem = undefined;
    }
    monitorview = new digitaljs.MonitorView({model: monitor, el: $('#monitor') });
    paper = circuit.displayOn($('<div>').appendTo($('#paper')));
    circuit.on('userChange', () =&gt; {
        updatebuttons();
    });
    circuit.on('changeRunning', () =&gt; {
        updatebuttons();
    });
    updatebuttons();
    $('#monitorbox button').prop('disabled', false);
    $('#monitorbox button[name=ppt_up]').on('click', (e) =&gt; { monitorview.pixelsPerTick *= 2; });
    $('#monitorbox button[name=ppt_down]').on('click', (e) =&gt; { monitorview.pixelsPerTick /= 2; });
    $('#monitorbox button[name=left]').on('click', (e) =&gt; { 
        monitorview.live = false; monitorview.start -= monitorview.width / monitorview.pixelsPerTick / 4;
    });
    $('#monitorbox button[name=right]').on('click', (e) =&gt; { 
        monitorview.live = false; monitorview.start += monitorview.width / monitorview.pixelsPerTick / 4;</div>

digitaljs

Digital logic simulator

BSD-2-Clause
Latest version published 8 months ago

Package Health Score

56 / 100
Full package analysis