Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aneldev/dyna-universal
Tiny library with universal tools
https://github.com/aneldev/dyna-universal
client-server isomorphic javascript nodejs universal
Last synced: 1 day ago
JSON representation
Tiny library with universal tools
- Host: GitHub
- URL: https://github.com/aneldev/dyna-universal
- Owner: aneldev
- License: mit
- Created: 2017-08-20T10:53:04.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-17T18:15:50.000Z (almost 6 years ago)
- Last Synced: 2024-10-02T20:06:25.084Z (about 1 month ago)
- Topics: client-server, isomorphic, javascript, nodejs, universal
- Language: JavaScript
- Size: 337 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
Small library for universal issues (browser-nodeJs war).
# Usage
## Use it with import
```
import {universal, dynaUniversal, isBrowser, isNode} from 'dyna-universal';universal; // is the node.js's global or browser's window
dynaUniversal // the DynaUniversal instance, is offers some tools
isNode; // boolean if we are in node
isBrowser; // boolean is we are is browser// console them
console.log('Are we are under node? Answer: ', dynaUniversal.isNode); // writes, true or false
console.log('Are we are under browser? Answer: ', dynaUniversal.isBrowser); // writes, true or false
console.log('Are we are under node? Answer: ', isNode); // writes, true or false
console.log('Are we are under browser? Answer: ', isBrowser); // writes, true or false```
## Use it with globals
```
import 'dyna-universal';console.log('Are we are under node? Answer: ', dynaUniversal.isNode); // writes, true or false
console.log('Are we are under browser? Answer: ', dynaUniversal.isBrowser); // writes, true or false```
# Exported properties
## isNode: boolean
Returns if it runs under node.js
## isBrowser: booleanReturns if it runs under browser.
# Exported variables
## universal: Window | Global
Is the node.js's `global` or browser's `window`.
## dynaUniversal: DynaUniversal
Instance of DynaUniversal providing some universal environment tools
# version
We follow semver.
# v0 beta
# v1 1st official
Has many breaking changes with v0.