Stay
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({
responseFields: ["myContent"],
infix: "/urlPatternForAsyncRequests",
timeoutPost: 0,
timeoutGet: 0,
autoUpdate: false
});
stay.addResponseField("myContainer");
stay.removeResponseField("main");
stay.addEventListener("navigate", function()
{
alert("Page navigation has started.");
});
stay.addEventListener("receive", function(event)
{
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 realizes a robust xhr-driven page navigation.
License
Copyright (c) 2015 Raoul van Rüschen
Licensed under the Zlib license.