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

summit-view-screenshot

v0.0.4

Published

Screenshot-panel for Summit View

Downloads

4

Readme

summit-view-screenshot

Screenshot-panel for Summit View

Usage

Simple example, by default the panel will cycle through a list of URL's to take screenshots of. Settings is avaible in the settings-section.

var summit = require('summit-view');
var Screenshot = require('summit-view-screenshot');

summit.listen(3000);

summit.panels([
    Screenshot,
]);

Usage - Periodic

var summit = require('summit-view');
var Screenshot = require('summit-view-screenshot');

summit.listen(3000);

// Screenshot periodically
summit.panels([
    Screenshot.init({
        url: 'https://www.npmjs.com/,https://github.com/',
        interval: 120,
        delay: 10,
        size: '1440x900',
    }),
]);

Usage - Webhook

By initializing the panel with mode: 'webhook' the panel will set up a route at listening for POST-requests.

var summit = require('summit-view');
var Screenshot = require('summit-view-screenshot');
var Q = require('q');

summit.listen(3000);

// Screenshot when a POST-request hits /summit-view-screenshot/screenshot
summit.panels([
    Screenshot.init({
        mode: 'webhook',
        delay: 10,
        size: '1440x900',
        filter: function(req) {
            var allowed = (req.body.secret == 'super-secret-string');
            return Q.when(allowed);
        },
        filterTarget: function(req) {
            return Q.when(req.body.url);
        },
    }),
]);

Options

Initialize the panel with an object to override any settings. Options that aren't specified will be available in the settings-section for the panel depending on the mode.

Available options

url

Type: string

Comma-separater list of url's to screenshot.
Not used if the panel is in webhook-mode.

interval

Type: number
Default: 120

The interval, in seconds, to take screenshots at.
Not used if the panel is in webhook-mode.

delay

Type: number
Default: 10

The delay, in seconds, to wait before taking a screenshot when visiting an url.

size

Type: string
Default: 1440x900

Size of the viewport when taking a screenshot.

mode

Type: string
Available values: webhook

Set the mode of the panel. Leave empty or set to anything for default behaviour.

Mode: webhook

A POST-route will be set up at /summit-view-screenshot/screenshot, requests can be filtered with filter and filterTarget.

filter(req)

Type: function
Default: All requests will be allowed.
Return: A promise with either true if a screenshot should be generated or false if not.

When the panel is in webhook-mode the filter-function will be called before a request is allowed to trigger a screenshot being generated. This is where you validate the payload of the request.

filterTarget(req)

Type: function
Default: The url will be assumed to be in req.body.url.
Return: A promise with the url to take a screenshot of.

When the panel is in webhook-mode the filterTarget-function will be called to get the url that should be used when generating a screenshot.