mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-03-26 08:14:27 +00:00
node-java 0.5.4
This commit is contained in:
34
java/java-tests.ts
Normal file
34
java/java-tests.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
///<reference path="java.d.ts"/>
|
||||
///<reference path="../bluebird/bluebird.d.ts"/>
|
||||
|
||||
import java = require('java');
|
||||
import BluePromise = require('bluebird');
|
||||
|
||||
java.asyncOptions = {
|
||||
syncSuffix: 'Sync',
|
||||
asyncSuffix: '',
|
||||
promiseSuffix: 'P',
|
||||
promisify: BluePromise.promisify
|
||||
};
|
||||
|
||||
java.registerClientP((): Promise<void> => {
|
||||
return BluePromise.resolve();
|
||||
});
|
||||
|
||||
interface ProxyFunctions {
|
||||
[index: string]: Function;
|
||||
}
|
||||
|
||||
java.ensureJvm()
|
||||
.then(() => {
|
||||
|
||||
// java.d.ts does not declare any Java types.
|
||||
// We can import a java class, but we don't know the shape of the class here, so must use any
|
||||
var Boolean: any = java.import('java.lang.Boolean');
|
||||
|
||||
var functions: ProxyFunctions = {
|
||||
accept: function(t: any): void { },
|
||||
andThen: function(after: any): any {}
|
||||
};
|
||||
var proxy: any = java.newProxy('java.util.function.Consumer', functions);
|
||||
});
|
||||
Reference in New Issue
Block a user