Socket
Socket
Sign inDemoInstall

sugarcube-ajax-save

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sugarcube-ajax-save

Sugarcube 2 extension for sending serialized save data and getting serialized save data form url.


Version published
Maintainers
1
Install size
31.8 kB
Created

Readme

Source

Sugarcube 2 (Twine) Ajax Saving

This module implements auto saving/loading via ajax. It does not deal with the server side or authentication, it's up to you to implement that.

Behavior

When your story loads, this module will make a simple GET request to the url stateUrlPath (parameter). If the repsonse is a text/plain save data, it will be passed to Sugarcube's Save.unserialize() to load the data. If this fails, nothing unordinary happens. The base saving system will take effect.

On the saving side, anytime a passage is loaded (ie whenever the normal autosave runs), this module will make a PUT request with the save state data to stateUrlPath.

Installing and Loading

If using npm with Tweego/Twee, you can simply install with npm i -S sugarcube-ajax-save. For Twine Desktop/Web... I'm not sure yet best approach for installing.

After installed, it needs to be loaded somewhere in your global js:

  import ajaxSaving from 'sugarcube-ajax-save';

  ajaxSaving({ Config, State, $document: $(document), jQuery, LoadScreen, LZString, stateUrlPath });

Further Improvements

Loading There may be a better standard for Twine/SugarCube modules.

FAQs

Last updated on 03 Mar 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc