New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callbacks like `weight` should not set `this` #1535

maxkfranz opened this Issue Sep 21, 2016 · 0 comments


None yet
1 participant

maxkfranz commented Sep 21, 2016

Functions passed to these APIs no longer set this to the element of interest:

  • eles.each()
  • eles.filter()
  • eles.positions()
  • eles.layoutPositions()
  • eles.bfs()
  • eles.dfs()
  • eles.dijkstra()
  • eles.aStar()
  • eles.bellmanFord()
  • eles.kruskal()
  • eles.floydWarshall()
  • eles.pageRank()
  • eles.closenessCentrality() & eles.closenessCentralityNormalized()
  • eles.betweennessCentrality() & eles.betweennessCentralityNormalized()
  • eles.degreeCentrality() & eles.degreeCentralityNormalized()
  • concentric layout (already deprecated)
  • cose layout (already deprecated)

In 2.x or 3.x, you can just use function( ele ){ return'weight'); } instead of function(){ return'weight'); }. It's better for ES2015 ele =>'weight') and arrow functions might expect the this reference to be unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment