package core.util

import android.os.Handler
import android.os.Looper
import android.os.Message

/**
 * info
 *
 * @author ReiChin_
 */
class WeakHandler(target: OnWeakListener) : Handler(Looper.getMainLooper()) {

    private val mTarget: OnWeakListener? by Weak { target }

    override fun handleMessage(msg: Message) {
        mTarget?.onWeakHandleMessage(msg)
    }

}

interface OnWeakListener {

    fun onWeakHandleMessage(msg: Message)

}