peterfriz/yii2-page-visibility

JS plugin that enables reacting to changes in the visibility state of a webpage

Installs: 8

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

dev-master 2016-04-18 22:03 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:14:40 UTC


README

JS plugin that enables reacting to changes in the visibility state of a webpage.

This simple plugin wraps the Page Visibility functionality for a Yii2 application.

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require peterfriz/yii2-page-visibility "dev-master"

or add

"peterfriz/yii2-page-visibility": "dev-master"

to the require section of your composer.json file.

Usage

Enable the plugin in a view file:

use peterfriz\pagevisibility\PageVisibilityAsset;
PageVisibilityAsset::register($this);

React on visibilty changes in js:

pageVisibility.init(
    function() {
        console.log('visible');
    },
    function() {
        console.log('hidden');
    }
);

License

yii2-page-visibility is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.