UNPKG

vue-diagram-editor-improved

Version:

Highly customizable diagram editor support for Vue.js

30 lines (27 loc) 777 B
import {ulid} from "ulid"; export default class Link { id = null; start_id = null; start_port = null; end_id = null; end_port = null; type = null; /** * @param {String} props.id * @param {String} props.start_id * @param {String} props.start_port * @param {String} props.end_id * @param {String} props.end_port * @param {String} props.type */ constructor(props) { this.id = props.id || ulid(); if (!props.start_id) throw new Error('start_id is empty!'); this.start_id = props.start_id; this.start_port = props.start_port || 'default'; if (!props.end_id) throw new Error('end_id is empty!'); this.end_id = props.end_id; this.end_port = props.end_port || 'default'; this.type = props.type || 'default'; } }