Open datasedai opened 8 years ago
After working with some folks to try to help them integrate with Endpoint.js, I think it would make more sense to remove the .facade() syntax; instead, if the returning object has any 'function' property at all (or a prototype), then just return it as a facade type.
To mitigate getting properties off the object, we can use a '.getProperties()' function on the facade, which will execute like a strategy function and return facades or json/primitives.
This should tie in to the solution to #4
As an alternative, the strategy can have 'returnAsFacade()' or 'returnAsObject()' to override the automatic behavior (for performance) when desired.
Using facades is a bit clunky, it could be cleaned up.
For instance, when a facade is ready, you have this code here:
It would be nicer if we could do something like this:
This way it would kinda look like what it looks like when you're using the facade to call functions.
This would be harder to do for child facades:
The above is kinda clunky. It would be nice if we could get the API right away, then call child functions...
Maybe this could work. Needs to be thought out more.