1.0.3 • Published 7 years ago

jetroute v1.0.3

Weekly downloads
3
License
Apache 2.0
Repository
github
Last release
7 years ago

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

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago