New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@wide/pageflip

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wide/pageflip

Handle page transition when navigating

latest
Source
npmnpm
Version
2.1.1
Version published
Maintainers
4
Created
Source

Pageflip

Handle page transition when navigating, based on pjax.

Install

npm install @wide/pageflip --save

Usage

import pageflip from '@wide/pageflip'

pageflip({
  container: 'main',
  transition: 'fadeUp',
  transitions: {
    fadeUp: {
      from: el => fadeUpOut(el),
      to:   el => fadeUpIn(el)
    }
  }
})
  • container: selector of the element to update when the next page is loaded, default main
  • transition: default transition to apply, default noop
  • transitions: collection of available transitions
    • enter: called when the next page is loading, must return a Promise
    • leave: called when enter is resolved and the next page is loaded, ready to swap

Default transitions

Pageflip comme with 2 defaults transitions:

  • noop do absolutely nothing, swap directly the next page
  • fade a simple fade in/out of the page

Lifecycle and hooks

Pageflip apply the following process:

 click   ->   onLoad()   ->   transition.enter()   ->   page is  ->   onSwap()   ->   transition.leave()
on link                                                 loaded

You can interact around onLoad() and onSwap() with these hooks :

pageflip({
  beforeLoad(),
  afterLoad(),
  beforeSwap(),
  afterSwap()
})

Libraries

This package uses :

  • pjax

Authors

License

This project is licensed under the MIT License - see the licence file for details

FAQs

Package last updated on 16 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts