Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thecommieaxolotl/xeonic
-
https://github.com/thecommieaxolotl/xeonic
Last synced: about 7 hours ago
JSON representation
-
- Host: GitHub
- URL: https://github.com/thecommieaxolotl/xeonic
- Owner: TheCommieAxolotl
- License: mit
- Created: 2022-08-17T11:00:03.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-18T06:40:41.000Z (about 2 years ago)
- Last Synced: 2024-11-12T11:05:24.375Z (4 days ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ⚡ Xeonic
A simple, fast, and tiny Library for spa-style routing for static sites.## Usage
```bash
npm i xeonic
``````js
import { initialiseRouter } from 'xeonic';
initialiseRouter();
``````html
import { initialiseRouter } from '/path/to/xeonic.mjs';
initialiseRouter();```
...and that's it!
## Features
Even though xeonic is similar to many other libraries, it has some other features.### Opt-In Elements
*Any* element can be used as a xeonic link, not just anchor tags.
```htmlHey, I'm a link now!
```
All you need to do is add the `xeon-include` and `href` attributes to the element.### Independent History
Xeonic stores its own history in `window.Xeonic.history`.
You can pop or push pages with
```js
Xeonic.goBack()
Xeonic.goForward()
Xeonic.goTo("url")
```## Configuration
```js
import { initialiseRouter } from 'xeonic';
initialiseRouter({
ignoreExternal: true, // ignore external links, WARNING: you may encounter errors with CORS if this is disabled
prefetch: true, // prefetch links for faster navigation
logs: true, // logs all navigation events to the console
});
```## TODO
- [x] Add listenable navigation events
- [x] Add ability to navigate back and forward
- [ ] Add a `mergeHead` option to merge the heads of documents and not replace them## Inspiration
This Project is heavily inspired by [flamethrower](https://github.com/fireship-io/flamethrower)