Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitnbytesio/slightjs
Slightjs used for speed optimization or for single page applications.
https://github.com/bitnbytesio/slightjs
Last synced: 8 days ago
JSON representation
Slightjs used for speed optimization or for single page applications.
- Host: GitHub
- URL: https://github.com/bitnbytesio/slightjs
- Owner: bitnbytesio
- License: gpl-2.0
- Created: 2015-01-01T15:11:48.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-24T08:10:02.000Z (about 9 years ago)
- Last Synced: 2024-11-09T05:04:45.527Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 50.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
slightjs (Beta Version)
========Slightjs used for speed optimization.
## How to use?
First attach slight.js to your web page. Make sure jquery is already attached before using slight.js (Slight depends on jquery).
**Use the below javascript codes**
Note: make sure you have all the page avilable on your host (Used in the below script example or change according to your application)
```javascript
Slight = new SlightPlugin({
url:"http://example.com/",
before: function() {
// show page loader
$(".page-loader").css("visibility", "visible");
},
after: function() {
// hide page loader
$(".page-loader").css("visibility", "hidden");
}
});Slight.router('index.php', function(){
// do some action here
});
Slight.router('create.php', function(){
// do some action here
}).after(function() {
// execute some javascript codes
$("#createUserForm").actionAjax();}).before(function(){
// before callback
});
Slight.router('edit.php', function() {}).after(function() {
// execute some javascript codes
$("#editUserForm").actionAjax();}).scripts(['http://cdn.host.com/some_lib/ver/script.js', 'some_local_script.js']).css(['edit_stylesheet.css']);
Slight.notFound(function(){
// take some action on missing route
});Slight.router('login.php', function() {}).after(function() {
// execute some javascript after request completed
$("#userLoginForm").actionAjax();});
Slight.router('list.php', function() {
// do some action here
});
// lets start the app
Slight.listen();```
**HTML Example**
Note: Slight make ajax request to requested page or url. Make sure you have coded you page acc. to it. Avoid loading full layout page.
```html
Slight JS Beta Version
```