1.0.0 • Published 4 years ago

dream-macro v1.0.0

Weekly downloads
-
License
MPL-2.0
Repository
-
Last release
4 years ago

Dream macro JS

Javascript package for DreamMacro.

Instalation

Include it via CDN:

<script type="module" src="https://cdn.jsdelivr.net/npm/dream-macro-js@1.0.0/dist/dream-js-min.js"></script>
<script type="module">
    // your code here
</script>

Quick start

To initialize LibreOffice Online, add a button, and call a python macro when the button is pressed, simply do that:

<script type="module">
        import { LOOL } from 'https://cdn.jsdelivr.net/npm/dream-macro-js@1.0.0/dist/dream-js-min.js';
        const lool = new LOOL("loolIframe");
        const setColor = () => {
            lool.callMacro('SetCellColor', 'SetCellColor', {
                x: {
                    type: 'long',
                    value: 0
                },
                y: {
                    type: 'long',
                    value: 0
                },
                color: {
                    type: 'long',
                    value: parseInt('0xff0000')
                }
            });
        };
        
        const button = {
            id: 'test_set_color',
            imgurl: 'http://localhost:8000/blood.png',
            hint: 'Set color of the first cell',
            label: 'Set color'
        }
        lool.addButton(button, setColor);
        lool.addMacroCallback('SetCellColor', 'SetCellColor', (data) => {
            console.log('Result set cell color macro: ' + data.result.value);
        })
</script>

Documentation

Read the documentation to read full API references: Documentation