GithubHelp home page GithubHelp logo

johnpittman / breadcrumbmanager-js Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 312 KB

Built as a way to track the previous history of anything and navigate back and forth through it in JavaScript.

License: MIT License

JavaScript 100.00%

breadcrumbmanager-js's Introduction

breadcrumbmanager

Built as a way to track the previous history of anything and navigate back and forth through it in JavaScript.

Notes

Universal module defined to be used with requirejs, node, commonjs, or global scoped if no module loader is used.

  • All files in the dist folder are minified for production use.
  • All files in the src directory are the source code for development use.
  • Packages point at the dist minified code with source maps.

Development

Requirements

  • nodejs
  • npm install
  • npm install -g gulp

Test

gulp test

Gulp Commands

Each process is dependent upon the previous. If one fails the build process exits.

  • gulp
  • gulp test (Unit specifications)
  • gulp build (Test, folder clean-ups, minification, source maps, renaming)
  • gulp deploy (Test, build, versioning)

Usage

Installation

npm: npm install breadcrumbmanager
bower: bower install breadcrumbmanager

How to use...

var bcm = new BreadcrumbManager(5);

bcm.add('1');
bcm.add('2');
bcm.add('3');
bcm.add('4');
console.log('Breadcrumbs list: ' + bcm._breadcrumbs);

var breadcrumb = bcm.prev();
breadcrumb = bcm.prev();
console.log('Navigate back twice. Breadcrumb: ' + breadcrumb);

bcm.add('5');
console.log('Visit a new path and add: 5');
console.log('Breadcrumbs list: ' + bcm._breadcrumbs);

breadcrumb = bcm.prev();
console.log('Navigate back once. Breadcrumb: ' + breadcrumb);

breadcrumb = bcm.next();
console.log('Navigate forward once. Breadcrumb: ' + breadcrumb);
breadcrumb = bcm.next();
console.log('Navigate forward once. Breadcrumb: ' + breadcrumb);

var contains = bcm.contains('1');
console.log('Check history for 1. Breadcrumb found: ' + contains);

console.log('Add 8 breadcrumbs to breach the set limit of 5.');
bcm.add('6');
bcm.add('7');
bcm.add('8');
bcm.add('9');
bcm.add('10');
bcm.add('11');
bcm.add('12');
bcm.add('13');
console.log('Breadcrumbs list: ' + bcm._breadcrumbs);

console.log('Clear breadcrumbs.');
bcm.clear();

Release Notes

v1.1.0

Breaking Changings...

  • Changed the name of the breadcrumbmanager.js to BreadcrumbManager.js. Captial file names for classes just make more sense to me so I can distiguish bundles and frameworks from single classes.

Additional...

  • Change the "main" property in package.json to point to the src/EventHandler.js since node is what uses it and needs the source code for debugging. If using things like Browserify it won't matter since the minification process happens after all files are compiled into one. This is better for everyone.

v1.0.4

  • Optimized the add method. Don't use slice.

v1.0.2

  • Going over the limit now contains the correct amount of breadcrumbs. Previously came up one short after adding a new breadcrumb at the limit.

v1.0.0

  • Fully tested and stable.

breadcrumbmanager-js's People

Contributors

johnpittman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.