This project is read-only.
2
Vote

SuperCache not working

description

Not sure if this is just me as well but having an issue with SuperCache. I have the default WAT project (universal) and in the config.json I set superCache to true and run the app and I get an exception:

Exception is about to be caught by JavaScript library code at line 547, column 21 in ms-appx://site2app1/template/js/wat.js

0x80040154 - JavaScript runtime error: Class not registered

If there is a handler for this exception, the program may be safely continued.

It is failing on
// start the SuperCache web server
                WatExtensions.SuperCacheManager.startAsync(new Windows.Foundation.Uri(WAT.config.baseURL), config)
                    .then(function () {

                        //// Umcomment the block below to handle and modify requests before resending them to the remote site
                        //WatExtensions.SuperCacheManager.onsendingrequest = function (args) {
                        //    logger.log("(OnSendingRequest) Sending request to:" + args.requestUri);
                        //};

                        //// Umcomment the block below to handle text responses received from the remote site before reaching the webview control
                        //WatExtensions.SuperCacheManager.ontextresponsereceived = function (args) {
                        //    logger.log("(OnTextResponseReceived) Response received from:" + args.requestUri);
                        //};

                        // When the requested page is not present in the cache
                        WatExtensions.SuperCacheManager.onofflinepageunavailable = function (args) {
                            if (WAT.config.offline.enabled) {
                                var offline = WAT.getModule("offline");
                                if (offline) {
                                    offline.forceOffline();
                                }
                            }
                        };

                        WAT.goToLocation((secondaryPinLocation) ? secondaryPinLocation : WAT.config.baseURL);
                    },
                    function (e) {
                        logger.error(e.message);
                    });
here is the config
"wat_offline": {
    "enabled": true,
    "message": "It looks like you are offline. Please reconnect to use this application.",
    "superCache": {
        "enabled": true,
        "baseDomainURL": "http://wat-docs.azurewebsites.net/",
        "addIndexedDBSupport": true,
        "imagesGuardBand": true,
        "preCacheURLs": [ "http://wat-docs.azurewebsites.net/GetStarted" ],
        "ignoreURLs": [ ]
    }
},

just trying out the demo project, i have not customized anything yet.

comments

alexjota wrote Feb 26, 2015 at 10:01 AM

Hi!

This issue is because the entries for the WatExtensions classes are missing in the app manifest for the application. This issue will be fixed in version 2.3 of the Universal Template. As a workaround until then, you can manually edit the file package.appxmanifest for your application, and add the following section at the end (before the <Package> closing element):
 
  <Extensions>
    <Extension Category="windows.activatableClass.inProcessServer">
      <InProcessServer>
        <Path>CLRHost.dll</Path>
        <ActivatableClass ActivatableClassId="AppPromo.RateReminder" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="AppPromo.RateReminderResult" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="AppPromo.RateHelper" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WatExtensions.SuperCache.PreloadScript" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WatExtensions.SuperCache.NavigatingEventArgs" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WatExtensions.SuperCache.Config.SuperCacheConfig" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WatExtensions.SuperCache.UriExtensions" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WatExtensions.SuperCacheManager" ThreadingModel="both" />
      </InProcessServer>
    </Extension>
  </Extensions>
 
You will need to apply this fix both in the Windows and the Windows Phone projects.

I hope this helps!
If you have any issues let me know.

Thanks
Ale