D3 rebind in v4

2,295 views
Skip to first unread message

gabriel montagné

unread,
Jul 21, 2016, 10:37:42 AM7/21/16
to d3-js
Hi,
 
I'm struggling to find out what happened to `d3.rebind` on the new V4.
Does it "live" somewhere else?
Or is it gone?
If so, how do you consolidate APIs now?

Cheers!
Gabriel

Mike Bostock

unread,
Jul 21, 2016, 10:50:20 AM7/21/16
to d3...@googlegroups.com
It was removed. If you need such functionality you can copy the implementation from v3:

https://github.com/d3/d3/blob/v3.5.17/src/core/rebind.js

Mike

gabriel montagné

unread,
Jul 21, 2016, 12:00:57 PM7/21/16
to d3-js, mi...@ocks.org
Thanks Mike.

RIP d3.rebind, you'll be sorely missed.

dhanda sunny

unread,
Aug 22, 2016, 10:15:11 PM8/22/16
to d3-js, mi...@ocks.org
Hi Mike, 

Can you please share code for d3.functor for d3v4.

or is there any other alternative ?

Adam

unread,
Aug 22, 2016, 10:20:35 PM8/22/16
to d3...@googlegroups.com
function d3_functor(v) {
  return typeof v === "function" ? v : function() { return v; };
}

https://github.com/d3/d3/blob/v3.5.17/src/core/functor.js

--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Mike Bostock

unread,
Aug 22, 2016, 10:22:10 PM8/22/16
to d3...@googlegroups.com
See also https://github.com/d3/d3-shape/blob/master/src/constant.js
On Mon, Aug 22, 2016 at 7:20 PM Adam <1wh...@gmail.com> wrote:
function d3_functor(v) {
  return typeof v === "function" ? v : function() { return v; };
}

https://github.com/d3/d3/blob/v3.5.17/src/core/functor.js

On Mon, Aug 22, 2016 at 10:15 PM, dhanda sunny <dhan...@gmail.com> wrote:
Hi Mike, 

Can you please share code for d3.functor for d3v4.

or is there any other alternative ?


On Friday, July 22, 2016 at 12:50:20 AM UTC+10, Mike Bostock wrote:
It was removed. If you need such functionality you can copy the implementation from v3:

https://github.com/d3/d3/blob/v3.5.17/src/core/rebind.js

Mike

--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages