Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VirtualDevice expose .available() #285

Merged
merged 2 commits into from
Jan 20, 2016
Merged

Conversation

AdamMagaluk
Copy link
Collaborator

Implements the available() on VirtualDevice to match methods exposed on Device. Fixes #278

.available() returns state based on what the cloud thinks the state of the device is on a hub getting info from logs topic stream and the return from a transition call. There could be times where the state does not line up.

@@ -121,6 +121,27 @@ VirtualDevice.prototype.call = function(/* transition, args, cb */) {

};

VirtualDevice.prototype.available = function(transition) {
return !!this._getAction(transition);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the list of actions is eventually consistent, there's always a chance of this being out-of-sync. Do we propagate a "Transition Not Available" error through virtual devices?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets returned in the callback function when you use .call.

@AdamMagaluk AdamMagaluk changed the title VirtualDevice exposes .available(), .transitionsAvailable(), and .properties() VirtualDevice expose .available() Jan 20, 2016
@mdobson
Copy link
Contributor

mdobson commented Jan 20, 2016

+1

AdamMagaluk added a commit that referenced this pull request Jan 20, 2016
@AdamMagaluk AdamMagaluk merged commit 0217151 into master Jan 20, 2016
@AdamMagaluk AdamMagaluk deleted the virtual-device-methods branch January 20, 2016 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants