Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

create isNode (or isServer) and isBrowser #397

Closed

Description

@PatrickJS
  • I'm submitting a ...
  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.
  • What modules are related to this pull-request
  • express-engine
  • grunt-prerender
  • gulp-prerender
  • hapi-engine
  • preboot
  • universal
  • webpack-prerender

return true or false per code split path

Activity

  1. jeffwhelpley commented on May 10, 2016

    @jeffwhelpley
    Contributor

    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.

  2. PatrickJS commented on May 10, 2016

    @PatrickJS
    ContributorAuthor

    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

  3. JohnGorter commented on May 30, 2016

    @JohnGorter
    Contributor

    Patrick,

    Talked about taking on this feature, tell me (here or slack) what needs to be done :-)

  4. jeffwhelpley commented on May 31, 2016

    @jeffwhelpley
    Contributor

    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:

    1. Have user pass in some value to Universal at build time that specifies the environment.
    2. Have Universal infer the environment based on some global known factor (ex. if (!window))

    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.

  5. PatrickJS commented on May 31, 2016

    @PatrickJS
    ContributorAuthor

    I ended up doing it via 2bdeb32

  6. angular-automatic-lock-bot commented on Sep 4, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions