nordnet / cordova-hot-code-push

[DEPRECATED] - This plugin provides functionality to perform automatic updates of the web based content in your application.
https://github.com/nordnet/cordova-hot-code-push/issues/371
MIT License
980 stars 466 forks source link

current root path predefined variable #202

Closed cordovapolymer closed 5 years ago

cordovapolymer commented 8 years ago

It would be great to have a predefined variable with current application root path, so it can be used for loading assets with javascript, like cordova plugin file does. This https://github.com/nordnet/cordova-hot-code-push/pull/170 pull request introduces a method to get current version name, it would be nice if you could extend it.

cordovapolymer commented 8 years ago

Here is the solution which I'm currently using:

          function absScriptLoc(filename) {
            var scriptElements = document.getElementsByTagName('script');
            for (var i = 0; i < scriptElements.length; i++) {
              var source = scriptElements[i].src;
              if (source.indexOf(filename) > -1) {
                var location = source.substring(0, source.indexOf(filename)) + filename;
                return location;
              }
            }
            return false;
          }
          var myAbsScriptLoc = absScriptLoc('chcp.js');
          var myAbsRootPath = myAbsScriptLoc.replace("plugins/cordova-hot-code-push-plugin/www/chcp.js", "");  ```
nikDemyankov commented 8 years ago

Thanks for the suggestion! Have you tried to load assets by relative path instead of full path? Also, if assets are not in manifest - I think you can load them from the bundled assets.

cordovapolymer commented 8 years ago

Thanks for the suggestion! Have you tried to load assets by relative path instead of full path?

yes, I tried everything!

Also, if assets are not in manifest - I think you can load them from the bundled assets.

They are in manifest as I'm currently updating whole app with chcp. I think I will use your suggestion to bundle most of the assets in future, to save space, thanks.

nordnet-deprecation-bot commented 5 years ago

👋 Hi! Thank you for your interest in this repo.

đŸ˜ĸ We are not using nordnet/cordova-hot-code-push anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹī¸ Please see #371 for more information.