package com.various.funny.sounds.audio.ui.fragment

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.various.funny.sounds.audio.data.NewBean
import com.various.funny.sounds.audio.db.MyRoomBase
import kotlinx.coroutines.launch

class HomeViewModel : ViewModel() {

    private   var _mdata: MutableLiveData<List<NewBean>> = MutableLiveData<List<NewBean>>()

    init {
        viewModelScope.launch {
            val data = MyRoomBase.dataBase.getNewBeanDao().getData()
            _mdata.value = data.shuffled()
        }
    }

    fun getList() = _mdata

    override fun onCleared() {
        super.onCleared()
    }


}