function pwa_file_data in Progressive Web App 7.2
Returns the JS of the service worker.
Return value
mixed
5 calls to pwa_file_data()
- pwa_preprocess_html in ./
pwa.module - Implements hook_preprocess_html().
- pwa_requirements in ./
pwa.install - Implements hook_requirements().
- _pwa_apple_create_image_base in includes/
pwa.apple.inc - _pwa_apple_drusplash_list in includes/
pwa.apple.inc - @file
- _pwa_apple_html_head_alter in includes/
pwa.apple.inc - Add apple specific variables.
1 string reference to 'pwa_file_data'
- pwa_menu in ./
pwa.module - Implements hook_menu().
File
- ./
pwa.module, line 228
Code
function pwa_file_data($file) {
$function = '_pwa_' . $file . '_file';
if (!in_array($file, [
'manifest',
'serviceworker',
]) || !function_exists($function)) {
return FALSE;
}
$cid = 'pwa:' . $file;
$data = cache_get($cid, 'cache');
if ($data) {
$data = $data->data;
}
else {
$data = $function();
cache_set($cid, $data, 'cache');
}
return $data;
}