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

fix: correct types #271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
36 changes: 4 additions & 32 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,21 @@
// Project: https://github.com/PeachScript/vue-infinite-loading
// Definitions by: Phil Scott <https://github.com/enkafan>
// PeachScript <https://github.com/PeachScript>
// Andrew Vasilchuk <https://github.com/andrewvasilchuk>

import Vue, { VNode, Component, PluginFunction } from 'vue';

export type SpinnerType = 'default' | 'bubbles' | 'circles' | 'spiral' | 'waveDots';
export type DirectionType = 'top' | 'bottom';

export interface Slots {
spinner: VNode[];
'no-result': VNode[];
'no-more': VNode[];
'error': VNode[];
[key: string]: VNode[];
}

export interface StateChanger {
loaded(): void;
complete(): void;
reset(): void;
error(): void;
}

export interface InfiniteOptions {
export interface PluginOptions {
props?: {
spinner?: SpinnerType;
distance?: number;
Expand All @@ -43,28 +36,7 @@ export interface InfiniteOptions {
};
}

export default class InfiniteLoading extends Vue {
// The trigger distance
distance: number;

// The load spinner type
spinner: SpinnerType;

// The scroll direction
direction: DirectionType;

// Whether find the element which has `infinite-wrapper` attribute as the scroll wrapper
forceUseInfiniteWrapper: boolean | string;

// Infinite event handler
onInfinite: ($state: StateChanger) => void;

// The method collection used to change infinite state
stateChanger: StateChanger;

// Slots
$slots: Slots;

static install: PluginFunction<never>;
declare class VueInfiniteLoading {
static install: PluginFunction<PluginOptions>
}