ozone-development/ozp-iwc — pull request #33 by mark-leone (2014-06-11 19:01:15+00:00)
Title: Feature promise

Resolves #11

Enables callbacks submitted to Client#send to control whether the callback persists or is executed only once. If the callback returns a truthy value, the client will retain the callback and continue to invoke it when messages are received with a replyTo ID equal to the ID for which the callback was registered. If the callback returns a falsey value, the client will remove it after the first time it is invoked.

The diffs in the referenced commits unfortunately include whitespace changes. You can suppress the whitespace in the diffs with ?w=1 in Github or -w in the git command line client.

The pull request also includes prior commits that should have been squashed, but were not. Previous versions of this feature used the native Promise object to provide one-time callback behavior, and provided a separate mechanism for persistent callbacks.

No unit tests were created for this feature, since the behavior is not conducive to unit testing. An integration test will be created for this feature, as part of the solution for Issue #31.