Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frankwallis/vertx-typescript
vert.x typescript definitions
https://github.com/frankwallis/vertx-typescript
Last synced: 3 months ago
JSON representation
vert.x typescript definitions
- Host: GitHub
- URL: https://github.com/frankwallis/vertx-typescript
- Owner: frankwallis
- License: epl-1.0
- Created: 2014-01-30T17:08:14.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-20T14:20:17.000Z (almost 11 years ago)
- Last Synced: 2024-04-10T16:05:51.959Z (10 months ago)
- Language: TypeScript
- Size: 262 KB
- Stars: 7
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
vertx-typescript
================vert.x typescript definitions
All the interfaces are declared in namespace Vertx.
There are external modules defined which correspond to the ones defined in the vert.x API. Some of these are also exposed via the main "vertx" module as they are in vert.x
Buffer and Pump are exposed as classes which can be created from your code.
JSDocs for vert.x can be found here: http://vertx.io/api/javascript/module-vertx.html
Example usage:
```typescript
///
///import vertx = require('vertx');
import console = require('vertx/console');var connections = new Array();
vertx.net.createNetServer().connectHandler((sock) => {
new vertx.Pump(sock, sock).start();connections.push(sock);
console.log("Received connection from " + sock.remoteAddress().ipaddress);sock.closeHandler(() => {
console.log(sock.remoteAddress().ipaddress + " disconnected");
connections.splice(connections.indexOf(sock), 1)
});
}).listen(1234);
```
```typescript
///
///
///import vertx = require('vertx');
import console = require('vertx/console');
import timer = require('vertx/timer');
import container = require('vertx/container');var buffer = new vertx.Buffer();
buffer.appendInt(1);function IncrementNumber(buff: Vertx.Buffer) {
buff.setInt(0, buff.getInt(0) + 1);
}function CancelTimer(id: Vertx.TimerId) {
timer.cancelTimer(id);
}timer.setPeriodic(400, () => console.log("Value now is " + JSON.stringify(buffer.getInt(0))));
var timerId = timer.setPeriodic(100, () => IncrementNumber(buffer));
timer.setTimer(5000, () => CancelTimer(timerId));timer.setTimer(8000, () => container.exit());
```
TODO
====- Datagram
- Compiler Tests
- Submit to DefinitelyTyped