Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/matronator/axette

Very simple and lightweight AJAX implementation for Nette
https://github.com/matronator/axette

ajax ajax-link nette nette-extension nette-framework

Last synced: 26 days ago
JSON representation

Very simple and lightweight AJAX implementation for Nette

Awesome Lists containing this project

README

        

![Axette logo](https://user-images.githubusercontent.com/5470780/122844829-ca28d100-d302-11eb-870f-050666075034.png)

![npm](https://img.shields.io/npm/v/axette)
![GitHub Repo stars](https://img.shields.io/github/stars/matronator/axette)
![Dependents (via libraries.io)](https://img.shields.io/librariesio/dependents/npm/axette)
[![CodeFactor](https://www.codefactor.io/repository/github/matronator/axette/badge)](https://www.codefactor.io/repository/github/matronator/axette)
![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/npm/axette)
![npm](https://img.shields.io/npm/dm/axette)
![NPM](https://img.shields.io/npm/l/axette)
![npm TypeScript version](https://img.shields.io/npm/dependency-version/axette/dev/typescript)
![GitHub Sponsors](https://img.shields.io/github/sponsors/matronator)
[![Buy us a tree](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen)](https://plant.treeware.earth/matronator/axette)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/U7U2MDBC)

# Axette

https://www.npmjs.com/package/axette

Very simple and lightweight AJAX implementation for [Nette](https://nette.org). Axette = AJAX for Nette!

## Table of Contents

- [Table of Contents](#table-of-contents)
- [Features](#features)
- [Installation](#installation)
- [With package manager (recommended)](#with-package-manager-recommended)
- [NPM:](#npm)
- [PNPM:](#pnpm)
- [Yarn:](#yarn)
- [Bun:](#bun)
- [With a `` tag:](#with-a-script-tag)
- [Migration from 1.x to 2.x](#migration-from-1x-to-2x)
- [Breaking changes](#breaking-changes)
- [Usage](#usage)
- [Custom CSS selector](#custom-css-selector)
- [Custom event listeners](#custom-event-listeners)
- [Events](#events)
- [`beforeInit`](#beforeinit)
- [`afterInit`](#afterinit)
- [`beforeAjax`](#beforeajax)
- [`afterAjax`](#afterajax)
- [Sending requests manually](#sending-requests-manually)
- [Remove `?_fid=XXXX` from URLs](#remove-_fidxxxx-from-urls)
- [Credits](#credits)
- [License](#license)

## Features

- Lightweight (**1kb** gzipped, **3kb** minified)
- Blazingly Fast
- No dependencies (no jQuery!)
- Simple to use
- Just import it, call `const axette = new Axette()` and you're done!
- Supports links and forms (`<a>` and `<form>` tags) to be handled by AJAX
- Handles snippet updates (`$this->redrawControl()`) as well as redirects (`$this->redirect()`)
- Automatically executes JavaScript inside `<script>` tags in the snippets returned from AJAX requests
- Get rid of `?_fid=6ge7` in the URL when using Flash Messages
- Attach custom callbacks to various events (`beforeInit`, `afterInit`, `beforeAjax`, etc...)

## Installation

### With package manager (recommended)

#### NPM:

```
npm install axette
```

#### PNPM:

```
pnpm install axette
```

#### Yarn:

```
yarn add axette
```

#### Bun:

```sh
bun add axette
# or
bun install axette
```

### With a `<script>` tag:

Download the [latest release](https://github.com/matronator/axette/releases/latest), move `axette.iife.js` from the `dist/` folder somewhere to your project and include it in your HTML or Latte file via a `<script>` tag.

```html
<!DOCTYPE html>
<html>
<head>
<title>Axette - AJAX for Nette!</title>
</head>
<body>
...

<!-- Local version -->
<script src="./path/to/axette.iife.js">
OR