Question: I'm trying to set a button that avoids user clicks multiple times at the same time. I tried

Method 1:

```
$(document).one('click','.button',function(){
    //coding......
});

```

Method 2:

```
$(document).on('click','.button',function(){
    $(this).prop('disabled',true);
    //coding....
    $(this).prop('disabled',false);
});

```

In method 1, is it possible to reset the function '.one'?  

Because I allow user to click again if the part of '//coding'
return false.
Or maybe there is another option?

Answer: 
> 
> Is there any way for the caller to check if the returning `Source` is empty or not before running it?
> 
> 
> 

No. The only way to determine whether a `Source` is empty is to run it.
> 
> Source
>  A processing stage with exactly one output, emitting data elements whenever downstream processing stages are ready to receive them.
> 
> 
> 

As per definition we can't know the element of source unless a downstream is there to receive.

So As per my understanding we can't check a source is empty or not without running it.
Please feel free to comment your thoughts

I think one way to achieve the requirement is

```
val x: Future[Boolean] = Source.empty.runWith(Sink.seq).transform{
   case Success(lst) => Success(lst.isEmpty)
   case Failure(_) => Success(true)
}

```