Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated method "wrap" #311

Merged
merged 2 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions Router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,6 @@ export interface WrappedComponent {
//_sveltesparouter?: boolean
}

/**
* Wraps a component to add route pre-conditions.
*
* @deprecated Use `wrap` from `svelte-spa-router/wrap` instead. This function will be removed in a later version.
*
* @param component Svelte component for the route
* @param userData Optional object that will be passed to each `conditionsFailed` event
* @param conditions Route pre-conditions to add, which will be executed in order
* @returns Wrapped component
*/
export function wrap(
component: typeof SvelteComponent,
userData?: object,
...conditions: RoutePrecondition[]
): WrappedComponent

/**
* Navigates to a new page programmatically.
*
Expand Down
21 changes: 0 additions & 21 deletions Router.svelte
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
<script context="module">
import {readable, writable, derived} from 'svelte/store'
import {tick} from 'svelte'
import {wrap as _wrap} from './wrap'

/**
* Wraps a component to add route pre-conditions.
* @deprecated Use `wrap` from `svelte-spa-router/wrap` instead. This function will be removed in a later version.
*
* @param {SvelteComponent} component - Svelte component for the route
* @param {object} [userData] - Optional object that will be passed to each `conditionsFailed` event
* @param {...function(RouteDetail): boolean} conditions - Route pre-conditions to add, which will be executed in order
* @returns {WrappedComponent} Wrapped component
*/
export function wrap(component, userData, ...conditions) {
// Use the new wrap method and show a deprecation warning
// eslint-disable-next-line no-console
console.warn('Method `wrap` from `svelte-spa-router` is deprecated and will be removed in a future version. Please use `svelte-spa-router/wrap` instead. See http://bit.ly/svelte-spa-router-upgrading')
return _wrap({
component,
userData,
conditions
})
}

/**
* @typedef {Object} Location
Expand Down
Loading