import { Component , ViewEncapsulation } from '@angular/core' ; import { ItemSliding , ToastController } from '../../../../../src' ; @ Component ( { templateUrl : 'page-one.html' , encapsulation : ViewEncapsulation . None } ) export class PageOne { chats : any [ ] ; logins : any [ ] ; constructor ( private toastCtrl ) { this . chats = [ { img : './assets/avatar-cher.png' , name : 'Cher' , message : 'Ugh. As if.' , time : '9:38 pm' } , { img : './assets/avatar-dionne.png' , name : 'Dionne' , message : 'Mr. Hall was way harsh.' , time : '8:59 pm' } , { img : './assets/avatar-murray.png' , name : 'Murray' , message : 'Excuse me, "Ms. Dione."' , time : 'Wed' } ] ; this . logins = [ { icon : 'logo-twitter' , name : 'Twitter' , username : 'admin' , } , { icon : 'logo-github' , name : 'GitHub' , username : 'admin37' , } , { icon : 'logo-instagram' , name : 'Instagram' , username : 'imanadmin' , } , { icon : 'logo-codepen' , name : 'Codepen' , username : 'administrator' , } ] ; } more ( item ) { console . log ( 'More' ) ; item . close ( ) ; } delete ( item ) { console . log ( 'Delete' ) ; item . close ( ) ; } mute ( item ) { console . log ( 'Mute' ) ; item . close ( ) ; } archive ( item ) { this . expandAction ( item , 'archiving' , 'Chat was archived.' ) ; } download ( item ) { this . expandAction ( item , 'downloading' , 'Login was downloaded.' ) ; } expandAction ( item , _ , text ) { setTimeout ( ( ) => { const toast = this . toastCtrl . create ( { message : text } ) ; toast . present ( ) ; item . close ( ) ; setTimeout ( ( ) => toast . dismiss ( ) , 2000 ) ; } , 1500 ) ; } }