Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

If variable exports is in global scope, Observer, ArraySplice, etc don't get put in global scope #81

Closed
@polpo

Description

@polpo

At issue is this code:

  if (typeof exports !== 'undefined') {
    if (typeof module !== 'undefined' && module.exports) {
      expose = exports = module.exports;
    }
    expose = exports;
  } 

If there is an exports global, expose gets assigned to that global. It looks like an attempt at putting observe-js into modules.exports when used as a Node.js module, which is good, but it doesn't actually work.

I was bit when I had a <div id="exports"> on my page. This created a global named exports (thanks to this crazy "feature"), so this code thought I was running node and stuffed the API into the exports global.

Perhaps this is a symptom of #66 - this stuff shouldn't be put into globals anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions