Closed davinkevin closed 8 years ago
We have now some parameters for each functions, so it's simple to mix up the order of parameters. For example :
ngstomp .subscribe('/topic/item', whatToDoWhenMessageComming, {}, $scope)
We have 4 parameters :
Some parameters are optional, like the scope and the headers, so if you want to unsubscribe from scope, you have to send useless object describing the headers...
I want to add a more intuitive and fluent API like this (proposition) :
ngstomp .subscribeTo('/topic/item') .callback(whatToDoWhenMessageComming) .withHeaders({}) .bindTo($scope) .build() /* ... or something else */
And if we have multiple subscribe :
ngstomp .subscribeTo('/topic/item') .callback(whatToDoWhenMessageComming) .bindTo($scope) .and() .subscribeTo('/topic/item') .callback(whatToDoWhenMessageComming) .withHeaders({}) .build();
Let me know if you have a better idea and help with PR ;)
We have now some parameters for each functions, so it's simple to mix up the order of parameters. For example :
We have 4 parameters :
Some parameters are optional, like the scope and the headers, so if you want to unsubscribe from scope, you have to send useless object describing the headers...
I want to add a more intuitive and fluent API like this (proposition) :
And if we have multiple subscribe :
Let me know if you have a better idea and help with PR ;)