diff --git a/types/vue-scrollto/index.d.ts b/types/vue-scrollto/index.d.ts index e020d29533..44be2c7fa7 100644 --- a/types/vue-scrollto/index.d.ts +++ b/types/vue-scrollto/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for vue-scrollto 2.14 +// Type definitions for vue-scrollto 2.15 // Project: https://github.com/rigor789/vue-scrollto#readme // Definitions by: Kovács Vince +// ChristianStornowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import { PluginFunction } from "vue"; +import { PluginFunction, PluginObject } from "vue"; declare namespace VueScrollTo { interface Options { @@ -16,7 +17,7 @@ declare namespace VueScrollTo { // The duration (in milliseconds) of the scrolling animation. Default: 500 duration?: number; // The easing to be used when animating. Default: ease - easing?: string; + easing?: string | [number, number, number, number]; // The offset that should be applied when scrolling. Default: 0 offset?: number; // Indicates if scrolling should be performed, even if the scroll target is already in view. Default: true @@ -45,10 +46,9 @@ declare namespace VueScrollTo { } } -declare class VueScrollTo { - static install: PluginFunction; - +interface VueScrollToPlugin extends PluginObject { scrollTo: VueScrollTo.VueStatic; + setDefaults: VueScrollTo.VueStatic; } declare module 'vue/types/vue' { @@ -57,4 +57,5 @@ declare module 'vue/types/vue' { } } +declare const VueScrollTo: VueScrollToPlugin; export = VueScrollTo; diff --git a/types/vue-scrollto/vue-scrollto-tests.ts b/types/vue-scrollto/vue-scrollto-tests.ts index 3ca628823b..d1803d05f2 100644 --- a/types/vue-scrollto/vue-scrollto-tests.ts +++ b/types/vue-scrollto/vue-scrollto-tests.ts @@ -2,10 +2,14 @@ import Vue from "vue"; import * as VueScrollTo from "vue-scrollto"; Vue.use(VueScrollTo); +Vue.use(VueScrollTo, {offset: -100}); + +VueScrollTo.setDefaults({offset: -100}); class Test extends Vue { mounted() { this.$scrollTo(this.$el, {offset: -100}); this.$scrollTo("#id"); + VueScrollTo.scrollTo("#id", {offset: -100}); } }