-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
127 additions
and
6,721 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
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,42 @@ | ||
import org.levi.coffee.Ipc | ||
import org.levi.coffee.annotations.BindMethod | ||
|
||
class Calculator { | ||
private var calCount = 0 | ||
|
||
@BindMethod | ||
fun add(a: Double, b: Double): Double { | ||
calCount++ | ||
dispatch() | ||
return a + b | ||
} | ||
@BindMethod | ||
fun sub(a: Double, b: Double): Double { | ||
calCount++ | ||
dispatch() | ||
return a - b | ||
} | ||
@BindMethod | ||
fun mul(a: Double, b: Double): Double { | ||
calCount++ | ||
dispatch() | ||
return a * b | ||
} | ||
@BindMethod | ||
fun div(a: Double, b: Double): Double { | ||
calCount++ | ||
dispatch() | ||
return a / b | ||
} | ||
|
||
@BindMethod | ||
fun get(): Int { | ||
return this.calCount | ||
} | ||
|
||
private fun dispatch() { | ||
if (calCount % 3 == 0) { | ||
Ipc.invoke("count") | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import io.ktor.server.application.* | ||
import io.ktor.server.engine.* | ||
import io.ktor.server.http.content.* | ||
import io.ktor.server.netty.* | ||
import io.ktor.server.routing.* | ||
|
||
fun main() { | ||
embeddedServer(Netty, port = 8080, host = "127.0.0.1") { | ||
routing { | ||
staticResources("/", "dist") { | ||
default("index.html") | ||
preCompressed(CompressedFileType.GZIP) | ||
} | ||
} | ||
}.start(wait = true) | ||
} | ||
//import io.ktor.server.engine.* | ||
//import io.ktor.server.http.content.* | ||
//import io.ktor.server.netty.* | ||
//import io.ktor.server.routing.* | ||
// | ||
//fun main() { | ||
// embeddedServer(Netty, port = 8080, host = "127.0.0.1") { | ||
// routing { | ||
// staticResources("/", "dist2") { | ||
// default("index.html") | ||
// preCompressed(CompressedFileType.GZIP) | ||
// } | ||
// } | ||
// }.start(wait = false) | ||
// println("Hello world") | ||
//} |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.