Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stackqueue

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stackqueue

A minimal setup stack queue

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Stack

This stack queue replicates async function like the one used in the Google Analytics (GA) snippet.

Where this comes in handy is putting javascript snippets on html pages without requiring external scripts. The ability to push data and events into a queue before a larger javascript file is loaded is invaluable in certain circumstances.

The code required to set up a stack queue object that is compatible with this library is minimal.

Browser

Usage like newer Google Analytics, wrapped in a function.

// Setup
var arr = [];
sq = sq || function() {
  arr.push(arguments);
};
sq.arr = sq.arr || arr;

// Usage
sq("log", "hello from stack!");

App

From our app we can treat the stack queue object as if it were created by the library.

var stackqueue = require("stackqueue");

var log = function(message) {
  console.log(message);
};

// Here we grab the sq declared in our html and initialise it.
stackqueue.flush(window.sq, { log: log });

// Output: "hello from stack!"

Keywords

FAQs

Package last updated on 18 Aug 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc