-
Notifications
You must be signed in to change notification settings - Fork 482
create isNode
(or isServer
) and isBrowser
#397
Comments
Nooooooooooooooooooooo. OK, so at the very least can we not expose this feature unless users set a config flag? I understand that we need this for certain low level libraries when we don't have control over the user bootstrap, but we should discourage the use of this in most cases. |
we should discourage use of it but we do need escape hatches. It's easier for demos and starting off with Universal. We should recommend how to refactor services/etc into the correct universal patterns |
Patrick, Talked about taking on this feature, tell me (here or slack) what needs to be done :-) |
Actually, to this point, I think during our last call, @gdi2290, you seemed to have an idea of how you wanted to implement this, but we never said it explicitly. There are really two approaches here:
It would seem like the first option is preferable which would mean we would be modifying the Universal API to accept in an environment value which is then stored at the platform level and is accessible through getters in the Universal API. If that lines up with what you are thinking, then the only question is whether the user should be able to check arbitrary environment values (ex. if (universal.isEnvironment('server'))) or if we want to just have a boolean isNode/isBrowser. I think you were leaning toward the later on this one, but that approach is less flexible. |
I ended up doing it via 2bdeb32 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
return
true
orfalse
per code split pathThe text was updated successfully, but these errors were encountered: