Skip to content

RevanthRyo/jetRoute

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jetRoute - Simple Route Manager

A simple jQuery route manager for fake SPA scripts, to be implemented in a fake SPA scenarios.

When you make a single script in webpack but you need to execute the scripts on exact pages, how do you do?

Getting Started

Download the production version or the development version.

In your web page:

<script src="jquery.js"></script>
<script src="dist/jetroute.min.js"></script>
<script>
$.jetRoute.settings = {
    routes: {"[Custom Route Name]", "[Custom Route]"},
    routeType: ,
    cookieName: 
  };
  $(document).ready(function(){
      $.jetRoute("[Custom Route Name]", function (){ 
          
      });
  });
</script>

Plugin Configuration

Default Configuration

$.jetRoute.settings = {
    routes: {"[Custom Route Name]", "[Custom Route]"},
    routeType: "window"
  };

Cookie Based

$.jetRoute.settings = {
    routes: {"[Custom Route Name]", "[Custom Route]"},
    routeType: "cookie",
    cookieName: "[Cookie Name]"
  };

Function Based

$.jetRoute.settings = {
    routes: {"[Custom Route Name]", "[Custom Route]"},
    routeType: function(){
        return "[URL Route as Paths]"
    }
  };

Plugin Usage

You can call the plugin everywhere. When you need to know if the route it's the one you are on pass the callback as "return true;". When you are using it at a $(document).ready(function(){}); you can pass the callback that will be executed if it's the route you are on.

$.jetRoute("[Custom Route Name]", function (){ [Callback] });

License

Apache 2.0 © Heitor Ramon Ribeiro

About

A simpe route manager for a fake SPA webpage with single loaded script.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 80.1%
  • HTML 19.9%