Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eldoy/waveorb-util
Utility functions for Waveorb
https://github.com/eldoy/waveorb-util
Last synced: 6 days ago
JSON representation
Utility functions for Waveorb
- Host: GitHub
- URL: https://github.com/eldoy/waveorb-util
- Owner: eldoy
- Created: 2022-05-02T20:40:09.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-23T11:15:20.000Z (8 months ago)
- Last Synced: 2024-10-26T12:01:30.564Z (20 days ago)
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Waveorb Util
Utility functions for [Waveorb.](https://waveorb.com)
Various Javascript functions needed for web applications. It is included in new Waveorb applications by default.
### Install
```
npm i waveorb-util
```### Usage
#### Frontend
Copy the `dist/util.js` file to the `app/assets/js/` folder in you application.
```js
var util = require('waveorb-util')// Include some
global.globals = ['sleep', 'clearErrors']
for (var fn of globals) {
global[fn] = util[fn]
}// Include all
global.globals = Object.keys(util)
for (var fn in util) {
global[fn] = util[fn]
}
```To make the available client side, include them in your layout, in the `head` or at the end of `body` tag, depending on your needs:
```js
async function()...
${global.globals.map(function(fn) {
return h`window.${fn} = ${util[fn]}`
})}
```
#### Backend
Install:
```
npm i waveorb-util
```Usage:
```js
var { sleep } = require('waveorb-util')
```To install functions globally server side, use the `init` hook:
```js
var util = require('waveorb-util')
global.sleep = util.sleep
```See the source code for documentation.
### License
ISC Licensed. Enjoy!