$ gnpm install fortress
Fortress is the Docker for front-end applications. It allows you to your code in a controlled and sandboxed environment. This library was originally designed for my bigpipe project which assumes that your front-end is split up in different pagelets or containers and each of these containers run it's own code.
This project has the following ambitious goals:
Array.prototype
with new methods. Nor will you
be affected by their changes.console.*
messages as each outputted in their own
container.While this library can only be used in browser environments, it's downloadable
through npm
so it can work browserify and other packaging systems. So to get
it through npm, simply run:
npm install fortress
For all other use cases, I would advice you to download the index.js
from the
latest stable tag. But if you are feeling adventures, you can also try the
master
branch.
'use strict';
//
// @TODO write actual documentations instead of this api listing.
//
var fort = new Fortress({ options });
//
// fort.all returns all created containers.
//
fort.all();
//
// fort.id returns the container based on the id.
//
fort.id(id);
//
// fort.create creates a new container. If code is supplied it will
// automatically start the newly created container. The options allows you
// control how the container is created and which restrictions it should force
// upon the code.
//
// This method returns the created `Container` instance so it can be manually
// controlled for greater control.
//
fort.create('var code = 1', { options });
//
// Start the container based on the id given.
//
fort.start(id);
//
// Stop the container based on the given id.
//
fort.stop(id);
//
// Restart the container. This is the same as stopping and starting your
// container.
//
fort.restart(id);
//
// When you stop a container it merely removes it from DOM. It does not mean it
// has been destroyed completely. If you never want to run this container again,
// kill it.
//
fort.kill(id);
This work is released under MIT. Pull request, contributions and bug reports are encouraged.
Copyright 2013 - present © cnpmjs.org | Home |