Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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.

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

















```