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

@zayesh/stay

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zayesh/stay

Stay is a small but effective library for the creation of dynamic xhr-driven web applications.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Stay

Build Status GitHub version npm version Dependencies

Stay is a small but effective module for the creation of dynamic xhr-driven web applications. It expects the server to be able to send the page content as a JSON string in which the key names correspond with the IDs of the target DOM containers.

Installation

Download the minified library and include it in your project:

<script src="/js/stay.min.js"></script>

You can also install this module with npm.

$ npm install @zayesh/stay

Usage

var Stay = require("@zayesh/stay");

var stay = new Stay({

	// Default is ["main", "navigation", "footer"]
	responseFields: ["myContent"],

	// Default is "/json"
	infix: "/urlPatternForAsyncRequests",

	// Default is 60000ms, 0 means no timeout
	timeoutPost: 0,

	// Default is 5000ms
	timeoutGet: 0,

	// Default is true
	autoUpdate: false

});

// You can also add and remove response fields.
stay.addResponseField("myContainer");
stay.removeResponseField("main");

stay.addEventListener("navigate", function() {

	alert("Page navigation has started.");

});

stay.addEventListener("receive", function(event) {

	/* If autoUpdate is set to false, the programmer can 
	 * decide when to update the page content.
	 * The response is the parsed JSON string from the server.
	 */

	stay.update(event.response);

});

stay.addEventListener("load", function() {

	alert("The requested page has been loaded.");

});

Documentation

API

Contributing

Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Release History

Version: 0.0.0 (28.06.2015)

The module realises a robust xhr-driven page navigation.

License

Copyright (c) 2015 Raoul van Rüschen
Licensed under the Zlib license.

Keywords

FAQs

Package last updated on 16 Sep 2015

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