Skip to content

Instantly share code, notes, and snippets.

@marenovakovic
Last active November 19, 2018 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marenovakovic/d7e016f9fb91a27b69c52ddbecdb7722 to your computer and use it in GitHub Desktop.
Save marenovakovic/d7e016f9fb91a27b69c52ddbecdb7722 to your computer and use it in GitHub Desktop.
package com.marko.presentation.base
import androidx.lifecycle.ViewModel
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlin.coroutines.CoroutineContext
abstract class BaseViewModel : ViewModel(), CoroutineScope {
private val job = Job()
override val coroutineContext: CoroutineContext
get() = Dispatchers.Main + job
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment