mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-23 11:50:15 +08:00
Added definitions for ng-stomp library
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="ng-stomp.d.ts" />
|
||||
|
||||
module ngStompTesting {
|
||||
|
||||
"use strict";
|
||||
var ngStompTest = "ngStompTest";
|
||||
|
||||
class test {
|
||||
constructor(private ngstomp:ngStomp) {
|
||||
var connectHeaders ={
|
||||
"Lol": "user",
|
||||
"Accept": "lol"
|
||||
};
|
||||
|
||||
ngstomp.connect('/endpoint', connectHeaders)
|
||||
|
||||
// frame = CONNECTED headers
|
||||
.then(function (frame) {
|
||||
|
||||
this.subscription = ngstomp.subscribe('/dest', function (payload, headers, res) {
|
||||
this.payload = payload;
|
||||
}, {
|
||||
"headers": "are awesome"
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
this.subscription.unsubscribe();
|
||||
|
||||
// Send message
|
||||
ngstomp.send('/dest', {
|
||||
message: 'body'
|
||||
}, {
|
||||
priority: 9,
|
||||
custom: 42 //Custom Headers
|
||||
});
|
||||
|
||||
// Disconnect
|
||||
ngstomp.disconnect(function () {
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module("app").controller(ngStompTest, test);
|
||||
}
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for ngStomp
|
||||
// Project: https://github.com/beevelop/ng-stomp
|
||||
// Definitions by: Lukasz Potapczuk
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
|
||||
interface ngStomp {
|
||||
sock:any;
|
||||
stomp:any;
|
||||
debug:any;
|
||||
off: any;
|
||||
|
||||
setDebug:(callback:Function)=> void;
|
||||
|
||||
connect: (endpoint:string, headers?:Headers)=> angular.IHttpPromise<any>;
|
||||
|
||||
disconnect: (callback:()=>void) => angular.IHttpPromise<any>;
|
||||
|
||||
subscribe: (destination:string, callback:Function, headers?:Headers, scope?:any) => any;
|
||||
|
||||
unsubscribe: () => any;
|
||||
|
||||
send: (destination:string, body:any, headers:Headers)=> any;
|
||||
|
||||
}
|
||||
|
||||
interface Headers {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user