Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
5 lars 1
<!doctype html>
2
<title>CodeMirror: Kotlin mode</title>
3
<meta charset="utf-8" />
4
<link rel=stylesheet href="../../doc/docs.css">
5
<link rel="stylesheet" href="../../lib/codemirror.css">
6
<script src="../../lib/codemirror.js"></script>
7
<script src="kotlin.js"></script>
8
<style type="text/css">
9
    .CodeMirror {
10
        border-top: 1px solid black;
11
        border-bottom: 1px solid black;
12
    }
13
</style>
14
<div id=nav>
15
    <a href="http://codemirror.net">
16
        <h1>CodeMirror</h1>
17
        <img id=logo src="../../doc/logo.png">
18
    </a>
19
    <ul>
20
        <li>
21
            <a href="../../index.html">Home</a>
22
            <li>
23
                <a href="../../doc/manual.html">Manual</a>
24
                <li>
25
                    <a href="https://github.com/codemirror/codemirror">Code</a>
26
    </ul>
27
    <ul>
28
        <li>
29
            <a href="../index.html">Language modes</a>
30
            <li>
31
                <a class=active href="#">Kotlin</a>
32
    </ul>
33
</div>
34
<article>
35
    <h2>Kotlin mode</h2>
36
    <div>
37
        <textarea id="code" name="code"> package org.wasabi.http import java.util.concurrent.Executors import java.net.InetSocketAddress import org.wasabi.app.AppConfiguration import io.netty.bootstrap.ServerBootstrap import io.netty.channel.nio.NioEventLoopGroup import io.netty.channel.socket.nio.NioServerSocketChannel
38
            import org.wasabi.app.AppServer public class HttpServer(private val appServer: AppServer) { val bootstrap: ServerBootstrap val primaryGroup: NioEventLoopGroup val workerGroup: NioEventLoopGroup { // Define worker groups primaryGroup = NioEventLoopGroup()
39
            workerGroup = NioEventLoopGroup() // Initialize bootstrap of server bootstrap = ServerBootstrap() bootstrap.group(primaryGroup, workerGroup) bootstrap.channel(javaClass
40
            <NioServerSocketChannel>()) bootstrap.childHandler(NettyPipelineInitializer(appServer)) } public fun start(wait: Boolean = true) { val channel = bootstrap.bind(appServer.configuration.port)?.sync()?.channel() if (wait) { channel?.closeFuture()?.sync() } } public
41
                fun stop() { // Shutdown all event loops primaryGroup.shutdownGracefully() workerGroup.shutdownGracefully() // Wait till all threads are terminated primaryGroup.terminationFuture().sync() workerGroup.terminationFuture().sync() } } </textarea>
42
    </div>
43
    <script>
44
        var editor = CodeMirror.fromTextArea(document.getElementById("code"),
45
        {
46
            mode:
47
            {
48
                name: "kotlin"
49
            },
50
            lineNumbers: true,
51
            indentUnit: 4
52
        });
53
    </script>
54
    <h3>Mode for Kotlin (http://kotlin.jetbrains.org/)</h3>
55
    <p>Developed by Hadi Hariri (https://github.com/hhariri).</p>
56
    <p>
57
        <strong>MIME type defined:</strong> <code>text/x-kotlin</code>.</p>
58
</article>