Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
  • SDK Reference
    • JavaScript SDK
    • PHP SDK
    • iOS SDK
    • Android SDK
  • Tools
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.getSession
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML Methods
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.getPageInfo
    • FB.Canvas.hideFlashElement
    • FB.Canvas.scrollTo
    • FB.Canvas.setAutoGrow
    • FB.Canvas.setDoneLoading
    • FB.Canvas.setSize
    • FB.Canvas.setUrlHandler
    • FB.Canvas.showFlashElement
    • FB.Canvas.startTimer
    • FB.Canvas.stopTimer

FB.Canvas.stopTimer

SDK Reference › JavaScript SDK › FB.Canvas.stopTimer

To be used in conjunction with setDoneLoading. Call stopTimer when you wish to stop timing the page load for a period of time, such as when you are waiting for the user to click a button on an interstitial page. Follow it by startTimer to restart the timer and then setDoneLoading when the page load is complete.

If you specify a callback function, it will be called with an integer, in milliseconds, of the timing of the page load, beginning from the time when the first bytes arrive on the client, and ending from the point at which you call this function.

Examples

To stop the timer, do

FB.Canvas.stopTimer();

you'll need to call startTimer before calling setDoneLoading.

To get the time elapsed so far, specify a callback. Here we pop up a dialog to display the load time so far.

FB.Canvas.stopTimer(
    function (result) {
        alert("Blocked on user input after " + result.time_delta_ms + " milliseconds");
    }
);

Parameters

NameTypeDescription
callbackFunction

(optional) A function called back with the intermediate page load time.

Updated about 8 months ago
Facebook © 2012 · English (US)
AboutCareersPlatform PoliciesPrivacy Policy