npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rikaaa-paging

v1.0.3

Published

rikaaa-paging is plugin in order to impliment asynchronous transition between website's page. This plugin is using Ajax,History API and Generator. The function of this plugin similar to [pjax](https://github.com/falsandtru/pjax-api/tree/master) and [b

Downloads

15

Readme

rikaaa-paging.js

rikaaa-paging is plugin in order to impliment asynchronous transition between website's page.
This plugin is using Ajax,History API and Generator.
The function of this plugin similar to pjax and barba.js.
Please see example.

Installation & Usage

import rikaaaPaging from "rikaaa-paging";

var entires = rikaaaPaging(
    ["#header", "#article", "#footer"],
    document.querySelectorAll("a")
);
<script src="rikaaa-paging/dist/rikaaa-paging.iife.js"></script>

var entires = self.rikaaaPaging(
    ["#header", "#article", "#footer"],
    document.querySelectorAll("a")
);

Progress

  1. The ahchor element was clicked. browser back | forward.
  2. The hookReady() method of this plugin will be triggerd.
  3. delay
  4. XMLHttpRequest
  5. The hookStart() method of this plugin will be triggerd.
  6. delay
  7. The website will be transformed.
  8. The hookEnd() method of this plugin will be triggerd.
  9. delay
  10. The hookResult() method of this plugin will be triggerd.
  11. history.pushState() method will be triggerd. The url was changed.
  12. back to list 1.

Constructor


var entires = rikaaaPaging(ArrayOfIdAttribute,NodeListOfAnchorElement);

| argument | description | | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | ArrayOfIdAttribute | The parameter to set array of html id attribute. The string of id attribute is equivalent with css selector. The HTML tag with this id will be updated. | | NodeListOfAnchorElements | The parameter to set nodelist of anchor element. The webpage transition and hookReady function will be start when this anchor elements clicked. |

Methods

・entires.hookReady(function)


The method will be triggerd when the anchor element you seted clicked or browser back / forward.
The argument of this method is must be function with return own argument or function with return "false". If the return value is own argument,The process of this plugin will be continu. If the return value is false, The process of this plugin will be cancel.

var entires = rikaaaPaging(["#header", "#article", "#footer"],document.querySelectorAll("a"));

entires.hookReady(function(config) {
    config.currentUrl;
    config.href;
    config.afterDelay = 1000;
    config.onProgress = function(progressByPercent){
        console.log(progressByPercent);
    };
    config.onDelay = function(progress){
        console.log(progress);
    };

    return config;
});

| parameter | type | description | | ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | config.currentUrl | string | The parameter is current url. | | config.href | string | The parameter is new url. The XMLHttpRequest use this parameter with XMLHttpRequest.open method. | | config.afterDelay | number | The parameter is delay time. This parameter delay entires.hookStart() method. The default value is 0. | | config.onProgress | Function | The parameter is function. This function will be running while XMLHttpRequest.onprogress event triggring. The progress value of XMLHttpRequest will be assigned to argument of this function. This range of value is 0 to 100. | | config.onDelay | Function | The parameter is function. This function will be running while Delaying entires.hookStart() method. The progress value of delay will be assigned to argument of this function. |

・entires.hookStart(function)


This method will be triggerd when XMLHttpRequest ended.
If you set "config.afterDelay" parameter with "hookReady" function,this function will be delay. The argument of this method is must be function with return own argument or function with return "false". If the return value is own argument,The process of this plugin will be continu. If the return value is false, The process of this plugin will be cancel.

var entires = rikaaaPaging(["#header", "#article", "#footer"],document.querySelectorAll("a"));



entires.hookStart(function(config) {
    config.ready;
    config.idAttributes;
    config.currentTargets;
    config.nextTargets;
    config.title;
    config.keywords;
    config.description;
    config.response;
    config.afterDelay;
    config.onDelay;

    return config;
});

| parameter | type | description | | -------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | config.ready | Record<string,any> | The parameter is same as own argument of function assigned entires.hookReady() method's argument. | | config.idAttributes | Array of string | The parameter is same as first argument of contructor. | | onfig.currentTargets | Record<string,Element> | The parameter is Record. The key is string of id attribute. The value is Element. This Element will be overwrited by value of config.nextTargets. | | config.nextTargets | Record<string,Element> | The parameter is Recorde. The key is string of id attribute. The value is Element. The Element will be added to curent DOM tree. | | config.title | string | The parameter is new content of title tag. | | config.keywords | Array of string | The parameter is new content of keywords. | | config.description | string | The parameter is new content of description. | | config.response | Recode<string,any> | The parameter is return value of XMLHttpRequest. However, this value is not parfect return value. | | config.afterDelay | number | The parameter is delay time. This parameter delay entires.hookEnd() method. The default value is 0. | | config.onDelay | Function | The parameter is function. This function will be running while Delaying entires.hookEnd() method. The progress value of delay will be assigned to argument of this function. |

・entires.hookEnd()


This method will be triggerd when the dom overwrited.
If you set "config.afterDelay" parameter with "hookStart" function,this function will be delay. The argument of this method is must be function with return own argument or function with return "false". If the return value is own argument,The process of this plugin will be continu. If the return value is false, The process of this plugin will be cancel.

var entires = rikaaaPaging(["#header", "#article", "#footer"],document.querySelectorAll("a"));

entires.hookEnd(function(config) {
    config.idAttributes;
    config.previousTargets;
    config.updatedTargets;
    config.newUrl;
    config.ready;
    config.start;
    config.afterDelay;
    config.onDelay;

    return config;
});

| parameter | type | description | | ---------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | config.idAttributes | Array of string | The parameter is same as first argument of contructor. | | config.previousTargets | Record<string,Element> | The parameter is Record. The key is string of id attribute. The value is Element. This Element was already overwrited by config.updatedTargets value. | | config.updatedTargets | Record<string,Element> | The parameter is Record. The key is string of id attribute. The value is Element. This Element was already added to DOM tree. | | config.newUrl | string | The parameter is new url. This parameter is third argument history.pushstate() method. | | config.ready | Record<string,any> | The parameter is same as own argument of function assigned entires.hookReady() method's argument. | | config.start | Record<string,any> | The parameter is same as own argument of function assigned entires.hookStart() method's argument. | | config.afterDelay | number | The parameter is delay time. This parameter delay entires.hookResult() method. The default value is 0. | | config.onDelay | Function | The parameter is function. This function will be running while Delaying entires.hookResult() method. The progress value of delay will be assigned to argument of this function. |

・entires.hookResult()

This method will be triggerd when just before history.pushState/history.replaceState.
If you set "config.afterDelay" parameter with "hookEnd" function. this function will be delay.
The argument of this method is function without return value.

var entires = rikaaaPaging(["#header", "#article", "#footer"],document.querySelectorAll("a"));

entires.hookResult(function(config) {
    config.oldUrl;
    config.newUrl;
    config.updatedTarget;
    config.previousTarget;
});

| parameter | type | description | | --------------------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | config.oldUrl | string | The parameter is old url. This url will be overwrite by new url. | | config.newUrl | string | The parameter is new url. | | config.updatedTarget | Record<string,Element> | The parameter is Record. The key is string of id attribute. The value is Element. This Element was already added to DOM tree. | | config.previousTarget | Record<string,Element> | The parameter is Record. The key is string of id attribute. The value is Element. This Element was already overwrited by config.updatedTargets value. |

・entires.curve(type,value)


The function of method will be easing value.

| argument | type | description | | -------- | ------ | -------------------------------------------------------------------------------------------------------------- | | type | string | The parameter to set easing type. The variety of this parameter is "LINER","EASE_IN","EASE_OUT","EASE_IN_OUT". | | value | number | The parameter to set value. This value will be easing. The range of parameter is 0 to 1. |

・entires.map(value,istart,istop,ostart,ostop)


The function of method is equivalent with map function of Processing.
Prease see https://processing.org/reference/map_.html

Browser Support

  • Google Chrome
  • Safari
  • Firefox
  • Edge
  • IE 11

License

Apache-2.0 © rikaaa.org