WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
Jetpack constantly calling device-jetpack.js (4 posts)

  1. gendalus
    Member
    Posted 8 months ago #

    Hi,

    I was just inspecting the performance of my site when I saw, that jetpack calls devicepx-jetpack.js over and over again and I don't really see why. I only enabled Mobile Theme and Statistics in the preferences.

    I'm using Safari 7.0.4 on OSX 10.9

    Here are two images out of the web inspector:
    http://cl.ly/image/1m1a0M2y2d0S/Bildschirmfoto%202014-07-03%20um%2013.48.27.png
    http://cl.ly/image/0r423Z1S2z2i/Bildschirmfoto%202014-07-03%20um%2013.48.34.png

    For me it seem's like a bug. Is this intended behavior?

    https://wordpress.org/plugins/jetpack/

  2. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 7 months ago #

    devicepx-jetpack should be running when the resolution of your screen or the page changes. For example, if you drag a window between a retina and non-retina display, or if you're on a hidpi display, it will upsize any photon'ed images or the like.

    What page is this happening on, so we can give it a look?

  3. enej
    Member
    Plugin Author

    Posted 7 months ago #

    Hi

    Looking at the code of devicepx-jetpack.js it looks like devicepx-jetpack.js runs a function called 'zoomImages' every second. This function ensures that every image on your page looks great on retina displays.
    The reason it runs every seconds is to make sure if new images are loaded to the browser, for example using the infinite scroll, will be displayed nicely on retina displays as well. The action is pretty fast and skips images that have already been resized as well as is disabled if you are not using a device with a high resolution retina display.
    The graph that you are seeing I believe is not devicepx-jetpack.js being loaded every time but the inspector telling you that the browser is performing an action because of devicepx-jetpack.js, running the 'zoomImages' function.

    I have created a github issue looking to look further at optimizing the devicepx-jetpack.js script. https://github.com/Automattic/jetpack/issues/820

    Let me know if you have further questions or anything else you would like me to take a look.

  4. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 7 months ago #

    BTW, for the curious, here's the full unminified devicepx-jetpack.js --

    http://s0.wp.com/wp-content/js/devicepx-jetpack.js?minify=false

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.