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

sswr

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sswr - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

2

dist/esm/index.js

@@ -1,1 +0,1 @@

var p=Object.defineProperty;var D=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var R=(e,t,r)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>{for(var r in t||(t={}))y.call(t,r)&&R(e,r,t[r]);if(D)for(var r of D(t))v.call(t,r)&&R(e,r,t[r]);return e};import{SWR as f}from"swrev";import{onDestroy as E,onMount as O}from"svelte";import{writable as W}from"svelte/store";var S=class extends f{useSWR(t,r){let n,s=W(void 0,()=>()=>n==null?void 0:n()),u=W(void 0,()=>()=>n==null?void 0:n());return O(()=>{s.set(this.get(this.resolveKey(t)));let o=l=>s.set(l),d=l=>u.set(l);n=this.use(t,o,d,i({loadInitialCache:!1},r)).unsubscribe}),E(()=>n==null?void 0:n()),{data:s,error:u,mutate:(o,d)=>this.mutate(this.resolveKey(t),o,i({revalidateOptions:r},d)),revalidate:o=>this.revalidate(this.resolveKey(t),i(i({},r),o)),clear:o=>this.clear(this.resolveKey(t),o)}}},c=e=>new S(e),a=c(),q=e=>(a=c(e),a),z=(e,t)=>a.subscribe(e,t),A=(e,t)=>a.subscribeErrors(e,t),B=e=>a.get(e),F=e=>a.getOrWait(e),G=(e,t,r,n)=>a.use(e,t,r,n),H=(e,t)=>a.useSWR(e,t),J=(e,t,r)=>a.mutate(e,t,r),L=(e,t)=>a.revalidate(e,t),N=(e,t)=>a.clear(e,t);export{S as SSWR,N as clear,q as createDefaultSWR,c as createSWR,B as get,F as getOrWait,J as mutate,L as revalidate,z as subscribe,A as subscribeErrors,a as swr,G as use,H as useSWR};
var K=Object.defineProperty;var D=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var R=(e,t,r)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u=(e,t)=>{for(var r in t||(t={}))x.call(t,r)&&R(e,r,t[r]);if(D)for(var r of D(t))h.call(t,r)&&R(e,r,t[r]);return e};import{SWR as P}from"swrev";import{onDestroy as m,onMount as g}from"svelte";import{writable as W,derived as c}from"svelte/store";var S=class extends P{useSWR(t,r){let n,s=W(void 0,()=>()=>n==null?void 0:n()),d=W(void 0,()=>()=>n==null?void 0:n());g(()=>{s.set(this.get(this.resolveKey(t)));let a=l=>{d.set(void 0),s.set(l)},o=l=>d.set(l);n=this.use(t,a,o,u({loadInitialCache:!1},r)).unsubscribe}),m(()=>n==null?void 0:n());let f=(a,o)=>this.mutate(this.resolveKey(t),a,u({revalidateOptions:r},o)),y=a=>this.revalidate(this.resolveKey(t),u(u({},r),a)),v=a=>this.clear(this.resolveKey(t),a),E=c([s,d],([a,o])=>a===void 0&&o===void 0),O=c([s,d],([a,o])=>a!==void 0&&o===void 0);return{data:s,error:d,mutate:f,revalidate:y,clear:v,isLoading:E,isValid:O}}},p=e=>new S(e),i=p(),z=e=>(i=p(e),i),A=(e,t)=>i.subscribe(e,t),B=(e,t)=>i.subscribeErrors(e,t),F=e=>i.get(e),G=e=>i.getOrWait(e),H=(e,t,r,n)=>i.use(e,t,r,n),J=(e,t)=>i.useSWR(e,t),N=(e,t,r)=>i.mutate(e,t,r),Q=(e,t)=>i.revalidate(e,t),T=(e,t)=>i.clear(e,t);export{S as SSWR,T as clear,z as createDefaultSWR,p as createSWR,F as get,G as getOrWait,N as mutate,Q as revalidate,A as subscribe,B as subscribeErrors,i as swr,H as use,J as useSWR};

@@ -1,1 +0,1 @@

(()=>{var K=Object.create;var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,m=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var v=(e,t,r)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>{for(var r in t||(t={}))y.call(t,r)&&v(e,r,t[r]);if(p)for(var r of p(t))P.call(t,r)&&v(e,r,t[r]);return e};var g=e=>s(e,"__esModule",{value:!0});var R=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var C=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!y.call(e,n)&&n!=="default"&&s(e,n,{get:()=>t[n],enumerable:!(r=x(t,n))||r.enumerable});return e},W=e=>C(g(s(e!=null?K(m(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var f=W(R("swrev")),d=W(R("svelte")),S=W(R("svelte/store")),E=class extends f.SWR{useSWR(t,r){let n,l=(0,S.writable)(void 0,()=>()=>n==null?void 0:n()),c=(0,S.writable)(void 0,()=>()=>n==null?void 0:n());return(0,d.onMount)(()=>{l.set(this.get(this.resolveKey(t)));let o=D=>l.set(D),u=D=>c.set(D);n=this.use(t,o,u,i({loadInitialCache:!1},r)).unsubscribe}),(0,d.onDestroy)(()=>n==null?void 0:n()),{data:l,error:c,mutate:(o,u)=>this.mutate(this.resolveKey(t),o,i({revalidateOptions:r},u)),revalidate:o=>this.revalidate(this.resolveKey(t),i(i({},r),o)),clear:o=>this.clear(this.resolveKey(t),o)}}},O=e=>new E(e),a=O(),F=e=>(a=O(e),a),G=(e,t)=>a.subscribe(e,t),H=(e,t)=>a.subscribeErrors(e,t),J=e=>a.get(e),L=e=>a.getOrWait(e),N=(e,t,r,n)=>a.use(e,t,r,n),Q=(e,t)=>a.useSWR(e,t),T=(e,t,r)=>a.mutate(e,t,r),U=(e,t)=>a.revalidate(e,t),V=(e,t)=>a.clear(e,t);})();
(()=>{var g=Object.create;var D=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,M=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var y=(e,t,r)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l=(e,t)=>{for(var r in t||(t={}))f.call(t,r)&&y(e,r,t[r]);if(p)for(var r of p(t))b.call(t,r)&&y(e,r,t[r]);return e};var I=e=>D(e,"__esModule",{value:!0});var c=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var L=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of w(t))!f.call(e,n)&&n!=="default"&&D(e,n,{get:()=>t[n],enumerable:!(r=C(t,n))||r.enumerable});return e},S=e=>L(I(D(e!=null?g(M(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var v=S(c("swrev")),R=S(c("svelte")),s=S(c("svelte/store")),E=class extends v.SWR{useSWR(t,r){let n,d=(0,s.writable)(void 0,()=>()=>n==null?void 0:n()),u=(0,s.writable)(void 0,()=>()=>n==null?void 0:n());(0,R.onMount)(()=>{d.set(this.get(this.resolveKey(t)));let a=W=>{u.set(void 0),d.set(W)},o=W=>u.set(W);n=this.use(t,a,o,l({loadInitialCache:!1},r)).unsubscribe}),(0,R.onDestroy)(()=>n==null?void 0:n());let K=(a,o)=>this.mutate(this.resolveKey(t),a,l({revalidateOptions:r},o)),x=a=>this.revalidate(this.resolveKey(t),l(l({},r),a)),h=a=>this.clear(this.resolveKey(t),a),P=(0,s.derived)([d,u],([a,o])=>a===void 0&&o===void 0),m=(0,s.derived)([d,u],([a,o])=>a!==void 0&&o===void 0);return{data:d,error:u,mutate:K,revalidate:x,clear:h,isLoading:P,isValid:m}}},O=e=>new E(e),i=O(),F=e=>(i=O(e),i),G=(e,t)=>i.subscribe(e,t),H=(e,t)=>i.subscribeErrors(e,t),J=e=>i.get(e),N=e=>i.getOrWait(e),Q=(e,t,r,n)=>i.use(e,t,r,n),T=(e,t)=>i.useSWR(e,t),U=(e,t,r)=>i.mutate(e,t,r),X=(e,t)=>i.revalidate(e,t),Y=(e,t)=>i.clear(e,t);})();

@@ -18,2 +18,4 @@ import * as svelte_store from 'svelte/store';

clear: (ops?: Partial<CacheClearOptions> | undefined) => void;
isLoading: svelte_store.Readable<boolean>;
isValid: svelte_store.Readable<boolean>;
};

@@ -79,2 +81,4 @@ }

clear: (ops?: Partial<CacheClearOptions> | undefined) => void;
isLoading: svelte_store.Readable<boolean>;
isValid: svelte_store.Readable<boolean>;
};

@@ -81,0 +85,0 @@ /**

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});var p=Object.defineProperty;var D=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var R=(e,t,r)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>{for(var r in t||(t={}))y.call(t,r)&&R(e,r,t[r]);if(D)for(var r of D(t))v.call(t,r)&&R(e,r,t[r]);return e};var _swrev = require('swrev');var _svelte = require('svelte');var _store = require('svelte/store');var S=class extends _swrev.SWR{useSWR(t,r){let n,s=_store.writable.call(void 0, void 0,()=>()=>n==null?void 0:n()),u=_store.writable.call(void 0, void 0,()=>()=>n==null?void 0:n());return _svelte.onMount.call(void 0, ()=>{s.set(this.get(this.resolveKey(t)));let o=l=>s.set(l),d=l=>u.set(l);n=this.use(t,o,d,i({loadInitialCache:!1},r)).unsubscribe}),_svelte.onDestroy.call(void 0, ()=>n==null?void 0:n()),{data:s,error:u,mutate:(o,d)=>this.mutate(this.resolveKey(t),o,i({revalidateOptions:r},d)),revalidate:o=>this.revalidate(this.resolveKey(t),i(i({},r),o)),clear:o=>this.clear(this.resolveKey(t),o)}}},c= exports.createSWR =e=>new S(e),a= exports.swr =c(),q= exports.createDefaultSWR =e=>(a= exports.swr =c(e),a),z= exports.subscribe =(e,t)=>a.subscribe(e,t),A= exports.subscribeErrors =(e,t)=>a.subscribeErrors(e,t),B= exports.get =e=>a.get(e),F= exports.getOrWait =e=>a.getOrWait(e),G= exports.use =(e,t,r,n)=>a.use(e,t,r,n),H= exports.useSWR =(e,t)=>a.useSWR(e,t),J= exports.mutate =(e,t,r)=>a.mutate(e,t,r),L= exports.revalidate =(e,t)=>a.revalidate(e,t),N= exports.clear =(e,t)=>a.clear(e,t);exports.SSWR = S; exports.clear = N; exports.createDefaultSWR = q; exports.createSWR = c; exports.get = B; exports.getOrWait = F; exports.mutate = J; exports.revalidate = L; exports.subscribe = z; exports.subscribeErrors = A; exports.swr = a; exports.use = G; exports.useSWR = H;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var K=Object.defineProperty;var D=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var R=(e,t,r)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u=(e,t)=>{for(var r in t||(t={}))x.call(t,r)&&R(e,r,t[r]);if(D)for(var r of D(t))h.call(t,r)&&R(e,r,t[r]);return e};var _swrev = require('swrev');var _svelte = require('svelte');var _store = require('svelte/store');var S=class extends _swrev.SWR{useSWR(t,r){let n,s=_store.writable.call(void 0, void 0,()=>()=>n==null?void 0:n()),d=_store.writable.call(void 0, void 0,()=>()=>n==null?void 0:n());_svelte.onMount.call(void 0, ()=>{s.set(this.get(this.resolveKey(t)));let a=l=>{d.set(void 0),s.set(l)},o=l=>d.set(l);n=this.use(t,a,o,u({loadInitialCache:!1},r)).unsubscribe}),_svelte.onDestroy.call(void 0, ()=>n==null?void 0:n());let f=(a,o)=>this.mutate(this.resolveKey(t),a,u({revalidateOptions:r},o)),y=a=>this.revalidate(this.resolveKey(t),u(u({},r),a)),v=a=>this.clear(this.resolveKey(t),a),E=_store.derived.call(void 0, [s,d],([a,o])=>a===void 0&&o===void 0),O=_store.derived.call(void 0, [s,d],([a,o])=>a!==void 0&&o===void 0);return{data:s,error:d,mutate:f,revalidate:y,clear:v,isLoading:E,isValid:O}}},p= exports.createSWR =e=>new S(e),i= exports.swr =p(),z= exports.createDefaultSWR =e=>(i= exports.swr =p(e),i),A= exports.subscribe =(e,t)=>i.subscribe(e,t),B= exports.subscribeErrors =(e,t)=>i.subscribeErrors(e,t),F= exports.get =e=>i.get(e),G= exports.getOrWait =e=>i.getOrWait(e),H= exports.use =(e,t,r,n)=>i.use(e,t,r,n),J= exports.useSWR =(e,t)=>i.useSWR(e,t),N= exports.mutate =(e,t,r)=>i.mutate(e,t,r),Q= exports.revalidate =(e,t)=>i.revalidate(e,t),T= exports.clear =(e,t)=>i.clear(e,t);exports.SSWR = S; exports.clear = T; exports.createDefaultSWR = z; exports.createSWR = p; exports.get = F; exports.getOrWait = G; exports.mutate = N; exports.revalidate = Q; exports.subscribe = A; exports.subscribeErrors = B; exports.swr = i; exports.use = H; exports.useSWR = J;
{
"name": "sswr",
"version": "1.4.0",
"version": "1.5.0",
"description": "Svelte stale while revalidate (SWR) data fetching strategy",

@@ -5,0 +5,0 @@ "repository": "github.com/ConsoleTVs/sswr",

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