embla-carousel
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -439,3 +439,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var internalEvents = eventStore_1.EventStore(); | ||
var externalEvents = eventStore_1.EventStore(); | ||
var resize = utils_1.debounce(onResize, 500); | ||
@@ -530,3 +529,2 @@ activate(options); | ||
function destroy() { | ||
externalEvents.removeAll(); | ||
state.active = false; | ||
@@ -573,3 +571,2 @@ deActivate(); | ||
return _extends(self, { | ||
addEvent: externalEvents.add, | ||
changeOptions: reActivate, | ||
@@ -576,0 +573,0 @@ destroy: destroy, |
{ | ||
"name": "embla-carousel", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "David Cetinkaya", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -1,4 +0,4 @@ | ||
# Embla Carousel ·   | ||
# Embla Carousel ·     | ||
Check out the demo [here](https://davidcetinkaya.github.io/embla-carousel). | ||
> Simple and sensible carousels for the web, written in TypeScript. | ||
@@ -88,3 +88,3 @@ Embla is a lightweight and simple carousel plugin for the web. Its purpose is to provide simple and extensible carousels that feels natural to interact with. It's 100% open source and free to use on both personal and commercial projects. Use it with the module bundler of your choice or by manually injecting the script. | ||
Embla comes with a few optional settings that you can change by passing an object as the second argument. **`Default`** values are: | ||
Embla comes with a few optional settings that you can change by passing an object as the second argument. **Default** values are: | ||
@@ -100,4 +100,2 @@ ```javascript | ||
startIndex: 0, | ||
onInit: () => false, | ||
onSelect: () => false, | ||
}) | ||
@@ -124,8 +122,2 @@ ``` | ||
**`onInit`** (function) | ||
Callback that runs when the carousel has mounted. | ||
**`onSelect`** (function) | ||
Callback that runs when a new slide target has been selected. | ||
## API | ||
@@ -150,7 +142,7 @@ | ||
**`goTo(index)`** | ||
**`goTo(index: number)`** | ||
Goes to item that matches passed index. If loop is enabled the carousel will seek the closest way to passed index. | ||
**`changeOptions(options)`** | ||
Reinitializes the carousel with passed options. This will do all calculations and setup the carousel from scratch. | ||
**`changeOptions(options: options)`** | ||
Reinitializes the carousel with passed options. This will do all the calculations and setup the carousel from scratch. | ||
@@ -160,7 +152,16 @@ **`destroy()`** | ||
**`addEvent(node, type, listener, options)`** | ||
Works just like the native addEventListener but Embla will store this event for you. Embla will kill events added this way for you when `destroy` is invoked. | ||
**`on(event: string, callback: function)`** | ||
Subscribes to a custom Embla event by firing the passed callback. Below is a list of events you can subscribe to: | ||
- **init** - Triggers after the carousel has been initialized for the first time. | ||
- **destroy** - Triggers after the carousel has been destroyed. | ||
- **select** - Triggers when a new target slide has been selected. | ||
- **dragStart** - Triggers when carousel dragging begins. | ||
- **dragEnd** - Triggers when carousel dragging ends. | ||
**`off(event: string, callback: function)`** | ||
Ends subscription to a custom Embla event by removing the passed callback. This works for all events listed on the **on** method. | ||
## License | ||
Embla is [MIT licensed](./LICENSE). |
64261
163
1816