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

famous-popup

v0.1.2

Published

Show and hide a queue of popups with Famo.us

Downloads

3

Readme

famous-popup

Show popup notifications with famous

Getting started

Install using npm

  npm install famous-popup

Or just copy popup.js to your project.

Usage:

Creating a PopupController:

var PopupController = require('famous-popup');

var popupCtrl = new PopupController({
	inTransition: function(){ ... } // RenderController inTransition
	outTransition: function(){ ... } // RenderController outTransition
	overlap: false // RenderController overlap
	global: false // Respond to Engine events
});

// Create a popup, which is just a RenderNode
var popup = new Surface({content: "Hello World!"});

Adding Popups:

// Add popup to the end of the queue (i.e. below all others)
popupCtrl.push(popup);

// Add popup to the front of the queue (i.e. above all others)
popupCtrl.unshift(popup);

// Replace current popup (or just show if there is no active popup)
popupCtrl.swap(popup);

// Whenever a popup is shown, popupCtrl emits an event:
popupCtrl.on('popup',function(popup) { .... });

Hiding Popups:

// Hide current popup
popupCtrl.hide();

// Hide specific popup
popupCtrl.hide(popup);

// Hide all popups
popupCtrl.clear();

// Popup can hide themselves by emitting a 'hide' event
popup.emit('hide');

// Whenever a popup is shown, popupCtrl emits an event:
popupCtrl.on('hide',function(popup) { .... });

Adding a background

var background = new Surface({
	properties: {
		'background-color':'rgba(0,0,0,0.8)'
	}
});

popupCtrl.backgroundFrom(background, {
	init: function() { .... },
	show: function() { .... },
	hide: function() { .....}
});

init,show and hide are callbacks bound to the background node StateModifier.

For example, the default background callbacks are:

PopupController.DEFAULT_BACKGROUND_OPTIONS = {
    init: function() {
        this.setOpacity(0);
        this.setTransform(HIDDEN);
    },
    show: function() {
        this.setTransform(VISIBLE);
        this.setOpacity(1,{curve:'linear',duration: 300});
    },
    hide: function(){
        this.setOpacity(0,{curve:'linear',duration: 300},function(){
            this.setTransform(HIDDEN);
        }.bind(this));
    }
};

Using events to trigger popups

// All methods exist as events:
popupCtrl.emit('push',popup);
popupCtrl.emit('unshift',popup);
popupCtrl.emit('swap',popup);
popupCtrl.emit('hide',popup);
popupCtrl.emit('clear');

// If you passed `engine: true` in options, 
// then you can use global events.
Engine.emit('popup-push',popup);
Engine.emit('popup-unshift',popup);
Engine.emit('popup-swap',popup);
Engine.emit('popup-hide',popup);
Engine.emit('popup-clear');

// Note: they are prefixed with `popup-`!

Changelog

0.1.2 (20/1/2014)

  • Fix famo.us dependency in package.json

0.1.1 (19/1/2014)

  • Little bugfix

0.1.0 (19/1/2014)

  • Initial release

Contribute

Feel free to contribute to this project in any way. The easiest way to support this project is by giving it a star.

Contact

© 2015 - Mark Marijnissen