Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@serwist/navigation-preload

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serwist/navigation-preload - npm Package Compare versions

Comparing version 9.0.0-preview.0 to 9.0.0-preview.1

26

dist/index.js
import { logger } from '@serwist/core/internal';
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/ // Give TypeScript the correct global.
/**
* @returns Whether or not the current browser supports enabling
* navigation preload.
*/ const isSupported = ()=>{
const isSupported = ()=>{
return Boolean(self.registration?.navigationPreload);
};
/**
* If the browser supports Navigation Preload, then this will disable it.
*/ const disable = ()=>{
const disable = ()=>{
if (isSupported()) {

@@ -35,14 +23,6 @@ self.addEventListener("activate", (event)=>{

/**
* If the browser supports Navigation Preload, then this will enable it.
*
* @param headerValue Optionally, allows developers to
* [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)
* the value of the `Service-Worker-Navigation-Preload` header which will be
* sent to the server when making the navigation request.
*/ const enable = (headerValue)=>{
const enable = (headerValue)=>{
if (isSupported()) {
self.addEventListener("activate", (event)=>{
event.waitUntil(self.registration.navigationPreload.enable().then(()=>{
// Defaults to Service-Worker-Navigation-Preload: true if not set.
if (headerValue) {

@@ -49,0 +29,0 @@ void self.registration.navigationPreload.setHeaderValue(headerValue);

6

package.json
{
"name": "@serwist/navigation-preload",
"version": "9.0.0-preview.0",
"version": "9.0.0-preview.1",
"type": "module",

@@ -32,3 +32,3 @@ "description": "This library allows developers to opt-in to using Navigation Preload in their service worker.",

"dependencies": {
"@serwist/core": "9.0.0-preview.0"
"@serwist/core": "9.0.0-preview.1"
},

@@ -38,3 +38,3 @@ "devDependencies": {

"typescript": "5.4.0-dev.20240203",
"@serwist/constants": "9.0.0-preview.0"
"@serwist/constants": "9.0.0-preview.1"
},

@@ -41,0 +41,0 @@ "peerDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc