Friday, July 3, 2015

AmdHarness is capable of CDN fallback

Another phase of AmdHarness has been accomplished. This time the feature I and many folks around been asked AMD authors: to have a fall back in case the CDN is not available.
When the primary application module loader.js failed to load google CDN, the in-project copy of AMD loader is used.
Perhaps you would ask yourself: why it is needed?
The answer is simple. While there are many good CDN reason to use CDN, it is not the environment you have control on. The network could be blocked in intranet, DNS is hijacked by local government, or whatever another reason preventing CDN access ... your app will be dead because the hunt for CDN candies.
Now it is not a case anymore. Embed the AMD loader into app, but make the loader on CDN default one. Enjoy the app running from CDN when available and still serve the app when CDN is broken for client.
Links:
Happy coding!

No comments:

Post a Comment