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

loadsync

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loadsync

Load javascript libraries in browser synchronously

  • 0.1.6
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by75%
Maintainers
1
Weekly downloads
 
Created
Source

loadsync

Load and execute javascript code in web browser synchronously

Installation

(Your web fronend project should use npm to manage libraries)

$ npm install --save loadsync

Usage

Include loadsync library:

var Loadsync = require('loadsync');

Declare States and timeout:

var loadsync = new Loadsync([{
	name: 'TIMEOUT',
	cards: ['STATE1', 'STATE2', 'STATE3'],
	timeout: 500
}, {
	name: 'NO_TIMEOUT',
	cards: ['STATE3', 'STATE4', 'STATE5']
}]);

Or reset it:

// create empty loadsync instance
// var loadsync = new Loadsync();

// reset steps and begin a new flow
loadsync.reset([{
	name: 'TIMEOUT',
	cards: ['STATE1', 'STATE2', 'STATE3'],
	timeout: 500
}, {
	name: 'NO_TIMEOUT',
	cards: ['STATE3', 'STATE4', 'STATE5']
}]);

Define the ready callback function after all of states have been checked:

loadsync.ready(function(info) {
	// code should be run after STATE1, STATE2, STATE3 have been checked
	// or there are some cards not be checked (timeout)
	// info.isTimeout: true/false
	// info.unchecked: list of unchecked cards
}, 'TIMEOUT');

Check each state that has been done (STATE1 for example):

loadsync.check('STATE1', 'TIMEOUT');

(the same with others: STATE2, STATE3):

loadsync.check('STATE2', 'TIMEOUT');
loadsync.check('STATE3', 'TIMEOUT');

FAQs

Package last updated on 17 Feb 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