1.1.3 • Published 5 years ago

ionic-swipeable-toasts v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Ionic Swipeable Toasts

Installation

Install this Package via npm i ionic-swipeable-toasts

Make it all work

To make everything work, you have to install hammerjs and init your Module like this:

import {IonicHammerJsConfig, IonicSwipeAbleToastsModule} from "ionic-swipeable-toasts";
 
 @NgModule({
   declarations: [
     ...
   ],
   imports: [
     ...,
     IonicSwipeAbleToastsModule.forRoot()
   ],
   bootstrap: [IonicApp],
   ],
   providers: [
       ...,
       {provide: HAMMER_GESTURE_CONFIG, useClass: IonicHammerJsConfig}
   ]
 })

Add the following Line wherever you want, preferably in the app.html:

<ionic-swipeable-toasts-component></ionic-swipeable-toasts-component>

To send a Toast, inject the IonicSwipeableToastsProvider in your constructor like this: constructor(private ionicSwipeableToastsProvider: IonicSwipeableToastsProvider) { ... }

and than call the toast Method on it:

this.ionicSwipeableToastsProvider.toast({
         message: 'Hallo'
       });

Options

OptionType
titlestring
messagestring
durationnumber
postionSwipeAbleToastPosition
typeSwipeAbleToastType
cssClassstring
iconstring
swipeDirectionsSwipeAbleToastDirection[]

The message is required! Default Value for duration is 3000.

SwipeAbleToastPosition

Specifies where the Toast will be shown. Default: TOP

Enum. Values: TOP, BOTTOM

SwipeAbleToastType

Specifies a general Background-Color.

Enum. Values are: SUCCESS, INFO, WARNING, DANGER

SwipeAbleToastDirection

Specifies in which direction the toast can be swiped away.

Enum. Values are: TOP, LEFT, RIGHT, DOWN

Notify: Top only works, when the Position is Top and Down only works when the Position is BOTTOM.

Example

A example of a Toast, that can be send:

this.ionicSwipeableToastsProvider.toast({
      message: 'Das ist ein Toast',
      type: SwipeAbleToastType.DANGER,
      duration: 5000,
      icon: 'add',
      cssClass: 'my-class',
      position: SwipeAbleToastPosition.BOTTOM,
      swipeDirections: [SwipeAbleToastDirection.DOWN, SwipeAbleToastDirection.LEFT]
    });
1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

0.5.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago