diff --git a/ng-stomp/ng-stomp-test.ts b/ng-stomp/ng-stomp-test.ts new file mode 100644 index 000000000..e27b1bd23 --- /dev/null +++ b/ng-stomp/ng-stomp-test.ts @@ -0,0 +1,48 @@ +/// +/// + +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); +} \ No newline at end of file diff --git a/ng-stomp/ng-stomp.d.ts b/ng-stomp/ng-stomp.d.ts new file mode 100644 index 000000000..df6397421 --- /dev/null +++ b/ng-stomp/ng-stomp.d.ts @@ -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 +/// + + +interface ngStomp { + sock:any; + stomp:any; + debug:any; + off: any; + + setDebug:(callback:Function)=> void; + + connect: (endpoint:string, headers?:Headers)=> angular.IHttpPromise; + + disconnect: (callback:()=>void) => angular.IHttpPromise; + + 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; + } + + + +