Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

How to resolve the problem _diagramMaker.default is not a constructor" #12

Closed
oo8549625 opened this issue Oct 7, 2020 · 1 comment
Closed

Comments

@oo8549625
Copy link

environment
diagram-maker: 1.0.0
parcel: 1.12.4
npm: 6.14.8
node: v14.8.0

index.html

<html>
<body>
  <script src="./index.js"></script>
  <div id="root"></div>
</body>
</html>

index.js

import DiagramMaker, { ConnectorPlacement } from 'diagram-maker';
import 'diagram-maker/dist/diagramMaker.css';
const diagramMaker = new DiagramMaker(
    'root',
    {
        options: {
            connectorPlacement: ConnectorPlacement.LEFT_RIGHT
        },
        renderCallbacks: {
            // Example Render Callback that displays the id within the node
            node: (node, container) => {
                const newDiv = document.createElement('div');
                const newContent = document.createTextNode(node.id);
                newDiv.appendChild(newContent);
                newDiv.classList.add('example-node');
                if (node.diagramMakerData.selected) {
                    newDiv.classList.add('selected');
                }
                container.innerHTML = '';
                container.appendChild(newDiv);
                container.addEventListener('click', myAwesomeEventListener);
            },
            // Example destroy callback that removes the event listener
            destroy: (container) => {
                container.removeEventListener('click', myAwesomeEventListener);
            }
        }

    },
    // optionalParams // { initialData, eventListener, consumerRootReducer, consumerEnhancer }
);
@sameergoyal
Copy link
Contributor

Duplicate of #13.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants