Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sundowndev committed May 15, 2019
2 parents 00f97a8 + 201eeb6 commit d973901
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 20 deletions.
43 changes: 36 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@
<img src="https://i.imgur.com/DKcKGvP.png" alt="">
</p>

## Table of Content

- [Features](#features)
- [Overview](#overview)
- [Usage](#usage)
- [npm](#npm)
- [Browser](#browser)
- [Browser support](#browser-support)
- [API](#api)
- [`.add(name: string, path: string, callback: function)`](#addname-string-path-string-callback-function)
- [`.map(prefixName: string, prefixPath: string, routes: Array)`](#mapprefixname-string-prefixpath-string-routes-array)
- [`.fetchRoute(name: string[, parameters: object])`](#fetchroutename-string-parameters-object)
- [`.route: object`](#route-object)
- [`.setErrorCallback(callback: function)`](#seterrorcallbackcallback-function)
- [`.notFoundException()`](#notfoundexception)
- [`.before(path: string, callback: function)`](#beforepath-string-callback-function)
- [`.run([callback: function])`](#runcallback-function)
- [License](#license)


## Features

- Dynamic routing & URL generator
Expand All @@ -38,6 +58,8 @@

## Overview

[![Edit leafeon](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/53xwl9120l?fontsize=14)

A simple route

~~~js
Expand Down Expand Up @@ -80,23 +102,30 @@ leafeon.map('docs_', '/docs', [
]);
~~~

## Installation (npm)
## Usage

#### npm

Install the package :

~~~shell
npm install leafeon
npm i leafeon --save
~~~

#### Usage

```js
const leafeon = require('leafeon').Router();
// or using ES6
// import * as leafeon from 'leafeon';
// const router = leafeon.Router();

leafeon.add('home', '/', function () {
leafeon.add('home', '/', () => {
document.write('hello world');
}).run();
})

leafeon.run();
```

## Browser usage
### Browser

1. Include leafeon.js in **<head>** or at the end of the **<body>**

Expand Down
6 changes: 4 additions & 2 deletions dist/leafeon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/leafeon.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/leafeon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lib/leafeon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d973901

Please sign in to comment.