https://github.com/threepointone/sandbox
sandboxed modules, ala YUI
https://github.com/threepointone/sandbox
Last synced: 2 months ago
JSON representation
sandboxed modules, ala YUI
- Host: GitHub
- URL: https://github.com/threepointone/sandbox
- Owner: threepointone
- Created: 2013-02-26T11:06:10.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-02-26T11:23:46.000Z (about 12 years ago)
- Last Synced: 2025-01-25T08:11:31.364Z (4 months ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# sandbox
sandboxing modules, ala YUI
## Installation
$ component install threepointone/sandbox
## API
```js// add modules to the sanbox registry with `.add()`
// add module 'aye'
sandbox.add('aye', function($) {
// `$` is the sandbox instance. to export, add to it.$.a = function() {
console.log('a!');
};});
// add another module 'bee', which depends on module 'aye'
sandbox.add('bee', function($) {$.b = function() {
$.a();
console.log('b!');
};},{
// declare dependecies here
uses: ['aye']
});// use it by first instantiating an instance of the sandbox
var s = sandbox();
// and then using whichever modules you'd like to
s.use('bee', function($){
$.b();
});// or like yui
sandbox().use('bee', function($){
$.b();
});// this will output -
// a!
// b!```
## Tests
Install dependencies with
```
npm install
```
then run
```
npm test
```## License
MIT