Open Beckerlionel opened 2 years ago
Hi Lionel,
This repo (and associated blog) is now 4 years old. A good chunk of it is still valid, but given APEX 21.2 and APEX 22.1 efforts around PWA, I would suggest you look into the new built-in features instead.
Hi Vincent,
Thanks a lot for your reply. Yes, futhermore the update of my Apex to 22.1 is schedule at tomorrow, so it's really more interesting to wait a day and use all the new features regarding PWA that you had explain in the last AskTom webinar.
Thanks a lot for all you work !
Best regards.
Lionel ----- Mail original -----
De: "Vincent Morneau" @.> À: "vincentmorneau/apex-pwa" @.> Cc: "Beckerlionel" @.>, "Author" @.> Envoyé: Jeudi 19 Mai 2022 15:32:50 Objet: Re: [vincentmorneau/apex-pwa] How to write WS file on root directory ? (Issue #25)
Hi Lionel, This repo (and associated blog) is now 4 years old. A good chunk of it is still valid, but given APEX 21.2 and APEX 22.1 efforts around PWA, I would suggest you look into the new built-in features instead. — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread. Message ID: <vincentmorneau/apex-pwa/issues/25/1131693580 @ github . com>
Hi Vincent,
Sorry to disturb you, but something doesn't works as I'm imagine.
Since the last release was update on my server, I try to use the new feature PWA. But I'm facing some issues.
Firstly, when I try to put in "default' function ans variables declaration part a custom function (yours which I found in your previous PWA github page), the devtools retrn me an error that this function is not defined ? Where I did wrong ?
Best regards.
Preview
let apex = { } ; apex . sw = { } ; apex . sw . CORE_CACHE_MATCHER = '#APEX_FILES#' ; apex . sw . CORE_CACHE_PREFIX = "APEX-CORE-" ; apex . sw . CORE_CACHE_NAME = apex . sw . CORE_CACHE_PREFIX + '#APEX_VERSION#' ; apex . sw . APP_CACHE_MATCHER = "&FB_FLOW_ID./files/static/v" ; apex . sw . APP_CACHE_PREFIX = "APEX-APP-&FB_FLOW_ID.-v" ; apex . sw . appCacheNeedsCleanup = true ; apex . sw . cleanAPEXCaches = ( ) => { caches . keys ( ) . then ( cacheNames => Promise . all ( cacheNames . map ( cacheName => { if ( cacheName . startsWith ( apex . sw . CORE_CACHE_PREFIX ) && cacheName !== apex . sw . CORE_CACHE_NAME ) { return caches . delete ( cacheName ) ; } } ) ) ) ; } ; apex . sw . cleanAppCaches = ( appCacheName ) => { if ( appCacheNeedsCleanup ) { appCacheNeedsCleanup = false ; caches . keys ( ) . then ( cacheNames => Promise . all ( cacheNames . map ( cacheName => { if ( cacheName . startsWith ( apex . sw . APP_CACHE_PREFIX ) && cacheName !== appCacheName ) { return caches . delete ( cacheName ) ; } } ) ) ) ; } } ; // "Function and Variable Declaration" hook starts const apexAppId = 434 ; // CHANGE_ME const apexPages = [ 1 , 2 , 3 ] ; // CHANGE_ME // It is recommended to have a page 404 as well, in case something goes wrong with the cache // Example: If the APEX app contains page 404 const apex404Page = [ 404 ] ; // CHANGE_ME // Leave these global variables as is const cacheStaticName = 'static-cache' ; const cache404Name = '404-cache' ; const cacheDynamicName = 'dynamic-cache' ; const apexPagesUrl = [ ] ; const apex404PagesUrl = [ ] ; async function installSW ( ) { let clientUrl ; // Getting the current page URL (with APEX session & everything else) await self . clients . matchAll ( { includeUncontrolled : true } ) . then ( clients => { for ( const client of clients ) { if ( new URL ( client . url ) . search . split ( ':' ) [ 0 ] === '?p=' + apexAppId ) { clientUrl = new URL ( client . url ) ; } } } ) ; if ( clientUrl ) { // Apply the current page URL to the array of static pages to cache (apexPages) for ( const apexPage of apexPages ) { let queryString = clientUrl . search . split ( ':' ) ; queryString [ 1 ] = apexPage ; queryString = queryString . join ( ':' ) ; apexPagesUrl . push ( clientUrl . origin + clientUrl . pathname + queryString ) ; } // Apply the current page URL to the array of static pages to cache (apex404Page) for ( const apexPage of apex404Page ) { let queryString = clientUrl . search . split ( ':' ) ; queryString [ 1 ] = apexPage ; queryString = queryString . join ( ':' ) ; apex404PagesUrl . push ( clientUrl . origin + clientUrl . pathname + queryString ) ; } // Store all static pages in the static cache const cacheStatic = await caches . open ( cacheStaticName ) ; cacheStatic . addAll ( apexPagesUrl ) . then ( function ( ) { console . log ( '[SW] Caching static files' , apexPagesUrl ) ; } ) . catch ( function ( err ) { console . error ( err ) ; } ) ; // Store all 404 pages in the 404 cache const cache404 = await caches . open ( cache404Name ) ; cache404 . addAll ( apex404PagesUrl ) . then ( function ( ) { console . log ( '[SW] Caching 404 files' , apex404PagesUrl ) ; } ) . catch ( function ( err ) { console . error ( err ) ; } ) ; } } // "Function and Variable Declaration" hook ends ----- Mail original -----
De: "Vincent Morneau" @.> À: "vincentmorneau/apex-pwa" @.> Cc: "Beckerlionel" @.>, "Author" @.> Envoyé: Jeudi 19 Mai 2022 15:32:50 Objet: Re: [vincentmorneau/apex-pwa] How to write WS file on root directory ? (Issue #25)
Hi Lionel, This repo (and associated blog) is now 4 years old. A good chunk of it is still valid, but given APEX 21.2 and APEX 22.1 efforts around PWA, I would suggest you look into the new built-in features instead. — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread. Message ID: <vincentmorneau/apex-pwa/issues/25/1131693580 @ github . com>
Hi Lionel,
Can't help you if you don't provide more info. What code did you put in what location, where and and when are you seeing the error?
Dear Vincent,
Thanks a lot for your answer. Yes I realized that I don't give you enought informations. To simplified my question, and to start at the beginning, currectly I try with the version 22.1 to use my PWA offline. But with the default file of sw, I can't navigate offline because of no pages are catched. Is it normal ?
Thank for your attention.
Regards.
Dear Vincent,
I have a very huge problem with PWA on APEX 22.1. I try to put some codes in order to have Offline capacity for my APEX APP. I follow your advices from your last Webinar to cached pages but as soon as I disconect my networt, nor pages are found into my cache !!!
Where I did wrong...I wasted my time one week ago...
Please help me if you have some times for me.
Enclosed, I send you my Ssw-hooks.js file to give an idea of what I code.
Is it a problem of "?session", or other...
Thanks a lot for your attention and your help.
Best regards.
Lionel ----- Mail original -----
De: "Vincent Morneau" @.> À: "vincentmorneau/apex-pwa" @.> Cc: "Beckerlionel" @.>, "Author" @.> Envoyé: Mardi 31 Mai 2022 04:04:53 Objet: Re: [vincentmorneau/apex-pwa] How to write WS file on root directory ? (Issue #25)
Hi Lionel, Can't help you if you don't provide more info. What code did you put in what location, where and and when are you seeing the error? — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread. Message ID: <vincentmorneau/apex-pwa/issues/25/1141593722 @ github . com>
A new Guide for Apex 22.1 would be fine ;-) It's awesome. Thx a lot
Dear Vincent,
Thanks a lot for this very clear explication. But in part 2 I have an other question. Is it possible to explain more deeply how to reach the root directory to write the ws file. I seach since a week with Oracle Developper Tools, throught out my APEX management pages, and with FTP connexion, but without any success.
Please put me "on the road" !
Best regards.
Lionel