'Cytoscape js + edgeHandles add weight property to edges

I can't for the life of me figure out how to add a new data property for edges dynamically created by the user. I'd like to add a weight property to every edge created, being a huge newbie I'm struggling to do so. I'm having a hunch that the edgeParams function of edgeHandles might be the solution, yet after hours of googling, I still unable to grasp an understanding on how that might work. Any help would be greatly appreciated.

Thanks in advance



Solution 1:[1]

Alright I managed it at last, for anyone in a similiar situation - use the edgeParams: function as follows.

          edgeParams: function( sourceNode, targetNode )
      {
        return {
              data: { weight: 75 },
             }
       },

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mlt