From 1eb907fdf5d0443beec1a6011200593c728d3aeb Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Thu, 7 Jan 2016 15:52:32 -0800 Subject: [PATCH] Prefix with d3, not d3_timer. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da5363e..0916b35 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,14 @@ In a vanilla environment, a `d3_timer` global is exported. [Try d3-timer in your ## API Reference -# d3_timer.timer(callback[, delay[, time]]) +# d3.timer(callback[, delay[, time]]) Schedules a new timer, invoking the specified *callback* repeatedly until the timer is [stopped](#timer_stop). An optional numeric *delay* in milliseconds may be specified to invoke the given *callback* after a delay; if *delay* is not specified, it defaults to zero. The delay is relative to the specified *time* in milliseconds since UNIX epoch; if *time* is not specified, it defaults to [Date.now](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now). The *callback* is passed two arguments when it is invoked: the elapsed time since the timer became active, and the current time. The latter is useful for precise scheduling of secondary timers. For example: ```js -var t = d3_timer.timer(function(elapsed, time) { +var t = d3.timer(function(elapsed, time) { console.log(elapsed, time); if (elapsed > 200) t.stop(); }, 150); @@ -48,7 +48,7 @@ Note that the first *elapsed* is 6ms, since this is the elapsed time since the t Use *delay* and *time* to specify relative and absolute moments in time when the *callback* should start being invoked. For example, a calendar notification for four hours before midnight on October 29, 2012 might be coded as: ```js -d3_timer.timer(callback, -4 * 1000 * 60 * 60, new Date(2012, 09, 29)); +d3.timer(callback, -4 * 1000 * 60 * 60, new Date(2012, 09, 29)); ``` If [timer](#timer) is called within the callback of another timer, the new timer callback (if eligible as determined by the specified *delay* and *time*) will be invoked immediately at the end of the current frame, rather than waiting until the next frame. Within a frame, timer callbacks are guaranteed to be invoked in the order they were scheduled (regardless of their start time). @@ -65,7 +65,7 @@ Stops this timer, preventing subsequent callbacks. This method has no effect if An opaque, unique identifier for this timer. -# d3_timer.timerFlush([time]) +# d3.timerFlush([time]) Immediately execute (invoke once) any eligible timer callbacks. If *time* is specified, it represents the current time; if not specified, it defaults to Date.now. Specifying an explicit time helps ensure deterministic behavior.