-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use a scheduler instead of an scheduled executor service for future/t…
…ask effects (#74) except for monix task which can be directly embedded into Eff and support timeout functionality
- Loading branch information
1 parent
7294e3b
commit de60e57
Showing
21 changed files
with
249 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.atnos.eff | ||
|
||
import scala.concurrent.duration.FiniteDuration | ||
import scala.scalajs.js.timers._ | ||
|
||
trait Schedulers { | ||
|
||
/** | ||
* Default Scheduler for JavaScript | ||
*/ | ||
def default: Scheduler = new Scheduler { | ||
def schedule(timedout: =>Unit, duration: FiniteDuration): () => Unit = { | ||
val handle = setTimeout(duration)(timedout) | ||
() => clearTimeout(handle) | ||
} | ||
|
||
override def toString = "Scheduler" | ||
} | ||
|
||
} | ||
|
||
object Schedulers extends Schedulers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.atnos.eff | ||
|
||
import java.util.concurrent.{ScheduledExecutorService, TimeUnit} | ||
|
||
import scala.concurrent.duration._ | ||
|
||
trait Schedulers { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.