@adoratorio/hades
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -32,3 +32,3 @@ import { DIRECTION, HadesOptions, Vec2, Easing, HadesPlugin } from "./declarations"; | ||
scrollTo(position: Partial<Vec2>, duration: number, prevent?: boolean): void; | ||
registerPlugin(plugin: HadesPlugin): Array<HadesPlugin>; | ||
registerPlugin(plugin: HadesPlugin | Array<HadesPlugin>): Array<HadesPlugin>; | ||
getPlugin(name: string): HadesPlugin | undefined; | ||
@@ -35,0 +35,0 @@ play(): void; |
@@ -193,5 +193,14 @@ "use strict"; | ||
Hades.prototype.registerPlugin = function (plugin) { | ||
if (typeof plugin.register === 'function') | ||
plugin.register(this); | ||
this.plugins.push(plugin); | ||
var _this = this; | ||
var register = function (plugin) { | ||
if (typeof plugin.register === 'function') | ||
plugin.register(_this); | ||
_this.plugins.push(plugin); | ||
}; | ||
if (Array.isArray(plugin)) { | ||
plugin.forEach(function (plugin) { register(plugin); }); | ||
} | ||
else { | ||
register(plugin); | ||
} | ||
return this.plugins; | ||
@@ -204,5 +213,7 @@ }; | ||
this.running = true; | ||
this.manager.on(this.scrollHandler); | ||
}; | ||
Hades.prototype.pause = function () { | ||
this.running = false; | ||
this.manager.off(); | ||
}; | ||
@@ -209,0 +220,0 @@ Hades.prototype.destroy = function () { |
@@ -34,3 +34,4 @@ "use strict"; | ||
if (typeof this.options.scrollNode === 'undefined') { | ||
throw new Error('Invalid Scroll Node for Virtual Render'); | ||
this.options.infiniteScroll = true; | ||
this.options.autoBoundaries = false; | ||
} | ||
@@ -37,0 +38,0 @@ this.options.scrollNode.style.webkitBackfaceVisibility = 'hidden'; |
{ | ||
"name": "@adoratorio/hades", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A smooth scrollbar based on Hermes, scroll down 'till hell", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -35,3 +35,3 @@ # Hades | ||
| root | `HTMLElement \| Window` | `document.body` | The DOM element or window on which the event listeners for Hermes will be atached to | | ||
| easing | `Function` | `Hades.EASING.LINEAR` | A function used to bend the progress over time to match a curve and create more natural scrolling inertia.<br />The function is called with a single parameter being the time normalized in relation with the total duration (`currentTime / totalDuration`) so the value is going from 0 to 1.<br> Eg. for a linear time `function(t) { return t; }`. It's always a advised to use a linear-in eased-out timing function to avoid weird visual artifacts when the scroll starts. <br />[Some enumerators are exposed](#EASING), just for having a bunch of useful functions out of the box.<br />If you wish BezierEasing from [bezier-easing npm package](https://npmjs.com/package/bezier-easing) can be used as easing function. | | ||
| easing | `Object` | `{ duration: 1000, mode: Hades.EASING.LINEAR }` | An object with the duration and a function used to bend the progress over time to match a curve and create more natural scrolling inertia.<br />The function is called with a single parameter being the time normalized in relation with the total duration (`currentTime / totalDuration`) so the value is going from 0 to 1.<br> Eg. for a linear time `function(t) { return t; }`. It's always a advised to use a linear-in eased-out timing function to avoid weird visual artifacts when the scroll starts. <br />[Some enumerators are exposed](#EASING), just for having a bunch of useful functions out of the box.<br />If you wish BezierEasing from [bezier-easing npm package](https://npmjs.com/package/bezier-easing) can be used as easing function. | | ||
| autoplay | `boolean` | `true` | Autostart the rendering cycle or not. | | ||
@@ -212,3 +212,3 @@ | aion | `Aion | null` | `null` | The Aion instance to use within to perform animations and per-frame operations. If passed this instance will be used, instead a new one is created. | | ||
```typescript | ||
public preScroll(context : Hades, event : HermesEvent) : void | ||
public scroll(context : Hades, event : HermesEvent) : void | ||
``` | ||
@@ -246,2 +246,2 @@ | ||
public scrollTo(context : Hades, position : Vec2, duration : number) : void | ||
``` | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
57407
1208
245
0