pconkie Posted July 3, 2019 Posted July 3, 2019 I have the following validdays.js file in a frogcode project var validDays = [ {from:'03/09/2018', until:'26/10/2018'}, {from:'05/11/2018', until:'21/12/2018'}, {from:'07/01/2019', until:'15/02/2019'}, {from:'25/02/2019', until:'05/04/2019'}, {from:'23/04/2019', until:'24/05/2019'}, {from:'03/06/2019', until:'23/07/2019'} ] It looks like terms dates, but only because it is test data. It will list valid days that detentions can take place on. It will be used in a couple of different widgets and a couple of apps too. While developing the js file was referenced in the project as other assets are e.g. Com.Frog.Utils.require( '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/assets/styles/main.css', '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/validdays.js', '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/assets/views/thumb.ejs', '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/assets/views/popover.ejs', '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/assets/views/main.ejs' ).then(function() { This worked fine until I deployed! I have realised that the require doesn't allow js to be loaded for a published app/widget. I really don't want to put the code into the app/widgets as this will duplicate it and require me to update it in multiple places. Any suggestion please for getting around this?
Simon Law Posted July 5, 2019 Posted July 5, 2019 On 7/3/2019 at 9:58 AM, pconkie said: I have the following validdays.js file in a frogcode project var validDays = [ {from:'03/09/2018', until:'26/10/2018'}, {from:'05/11/2018', until:'21/12/2018'}, {from:'07/01/2019', until:'15/02/2019'}, {from:'25/02/2019', until:'05/04/2019'}, {from:'23/04/2019', until:'24/05/2019'}, {from:'03/06/2019', until:'23/07/2019'} ] It looks like terms dates, but only because it is test data. It will list valid days that detentions can take place on. It will be used in a couple of different widgets and a couple of apps too. While developing the js file was referenced in the project as other assets are e.g. Com.Frog.Utils.require( '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/assets/styles/main.css', '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/validdays.js', '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/assets/views/thumb.ejs', '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/assets/views/popover.ejs', '//package/applications/189607D420048EA5819BDFE3CD8C91047FD735DC518F1808/assets/views/main.ejs' ).then(function() { This worked fine until I deployed! I have realised that the require doesn't allow js to be loaded for a published app/widget. I really don't want to put the code into the app/widgets as this will duplicate it and require me to update it in multiple places. Any suggestion please for getting around this? hi Paul, Mr Quince ask me to have look, what does it do when you try to use it? does it break Frog, show a horrible console log? I am also looking through the code base to see what else you could use
Simon Law Posted July 5, 2019 Posted July 5, 2019 var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { // Action to be performed when the document is read; } }; xhttp.open("GET", "/app/file/......validdays.js", true); xhttp.send(); that's just a quick google Have you tried saving it a XML? that will be seen as data file to the browser, not code. If that works the browser can take XML and parse it into data you can use
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now