Domanda

I recently read this article on ClientBundle and under the Levers and knobs section, see these two entries:

  • ClientBundle.enableInlining is a deferred-binding property that can be used to disable the use of data: URLs in browsers that would otherwise support inlining resource data into the compiled JS.
  • ClientBundle.enableRenaming is a configuration property that will disable the use of strongly-named cache files.

I'm having a tough time visualizing these in action and understanding what they do. Where do you set these properties? Why would you set them (i.e., when would I want to "disable the use of data", or "disable the use of strongly-named cache files")? Can someone provide a real-world use case and perhaps some code snippets for me? Thanks in advance!

È stato utile?

Soluzione

Where do you set these properties?

Deferred-binding properties are set in your gwt.xml with <set-property>.
See https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsDeferred

Why would you set them (i.e., when would I want to "disable the use of data", or "disable the use of strongly-named cache files")?

For debugging, or if the performance boost they're supposed to bring to your app actually does more harm than good (enableInlining'), or if you need/want to share the resources with other scripts/apps (enableRenaming`).

Can someone provide a real-world use case and perhaps some code snippets for me?

You'll know it when you need them. Until then, ignore them.

Altri suggerimenti

In case this is still useful, I have a real-world example of needing to disable inlineing.

But first, just to clarify the code needed its simply;

<set-property name="ClientBundle.enableInlining" value="false" />

In your XML to disable the use of DataURLs and use image strips instead

I had to do this in my code, because my project requires animated images. Even a basic sprite with just a few frames has very bad performance when using DataURLs. The browsers just struggle to update and display the images at anywhere near a reasonable framerate.

By comparison, the use of image strips, vastly speeds up performance. The browser merely has to change the cropping. In fact, given the lack-luster browser support for animated PNG's, if you need animated images, this is probably the current best way to do it.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top