https://github.com/obedm503/self
just use self
https://github.com/obedm503/self
Last synced: 3 months ago
JSON representation
just use self
- Host: GitHub
- URL: https://github.com/obedm503/self
- Owner: obedm503
- License: mit
- Created: 2018-12-10T01:38:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-10T01:53:01.000Z (over 6 years ago)
- Last Synced: 2025-01-16T00:39:24.159Z (5 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# self
Given the [troubles](https://github.com/tc39/proposal-global/issues/32) with adding a common global reference in the spec, just use `self`. `self` already exists in browser and worker environments. This script just adds a circular reference to the already existing global in the form of `self` if it's not already there.
This package was inspired by @pluma's comments [here](https://github.com/tc39/proposal-global/issues/32#issuecomment-443280846) and [here](https://github.com/tc39/proposal-global/issues/32#issuecomment-443291102) about `self` being a red herring. Although `self` is not as pretty as `global`, it works.
## usage
```js
// universal js code
require('@obedm503/self');self.console.log(self.self === self); // true
```