New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

springroll-container

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

springroll-container

The iframe controller for interacting with SpringRoll applications

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
395
decreased by-27.66%
Maintainers
4
Weekly downloads
 
Created
Source

SpringRoll Container

The <iframe> controller for interacting with SpringRoll applications either by SpringRoll Connect or accessing locally. The Container works both in the context of a Cordova-based application or on a webserver.

Installation

Install with Bower.

bower install springroll-container

Install with NPM.

npm install springroll-container

Usage

Basic usage for opening a SpringRoll application via a local path. This can be used to open a game with a relative or absolute (e.g. "http://...") path.

<iframe id="game" scrolling="no"></iframe>
<script>
    var container = new springroll.Container("#game");
    container.openPath("game.html");
</script>

Custom Interface Elements

The Container supports custom interface elements for managing things like toggle captions and sound. Here's an example of creating a button to toggle the sound within the game.

<button id="soundButton">Mute</button>
<iframe id="game" scrolling="no"></iframe>
<script>
	var container = new springroll.Container("#game", {
	    soundButton: "#soundButton"
	});
	container.openPath('game.html');
</script>
OptionDescription
helpButtonTriggers in-game help
captionsButtonToggles the display of captions
soundButtonToggles all audio mute
voButtonToggles only voice-over mute
sfxButtonToggles only sound effects mute
musicButtonToggles only music mute
pauseButtonPlays and pause the game

Play Options

The openPath method of the Container provides a mechanism for providing options directly to the game, called playOptions:

var container = new springroll.Container('#game');
container.openPath('game.html', {
    playOptions: {
        difficulty: 7,
        theme: 'blue'
    }
});

In a SpringRoll Application, the Container Client Plugin mirrors this data directly onto the object. Once the application finishes its init process, this data will be available directly on the application instance:

var app = new springroll.Application({
  // various options here
});

app.on('init', function() {
  springroll.Debug.log('Play Options are', app.playOptions); // { difficulty: 7, theme: 'blue' }
});

Any JSON-serializable object can be set as a playOption.

##Documentation

API Documentation has full documentation for the Container.

##License

Copyright (c) 2015 CloudKid

Released under the MIT License.

Keywords

FAQs

Package last updated on 29 Jun 2018

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