GitXplorerGitXplorer
w

SpringbokJS

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
00aa3e7e90a82bf5ef8c1dd61c2c2383ef3015de

Updated/improved docs

wwebpro committed 12 years ago
Unverified
1cbb545ab9a746ffb58b95f4c378d3c826dee11b

Using better hybrid AMD pattern

wwebpro committed 12 years ago
Unverified
4028f94530f8cc754475a1c8db670f66cb02d018

Removed crazy "loader" mechanism

wwebpro committed 12 years ago
Unverified
edf5eec1a240f5df2b3df16fa03fd4bbf60f4419

Simplified demo page

wwebpro committed 12 years ago
Unverified
f4abb49e8f89b46f99cf61afcc19e429ef009224

Simplified README

wwebpro committed 12 years ago
Unverified
7dc45c790909e0b8e585288a12d1bbefa40d8fe9

Use 'require()' instead of 'define()'

wwebpro committed 12 years ago

README

The README file for this repository.

SpringbokJS

Introduction

SpringbokJS installs modules (traditional object or AMD-style) based on HTML attributes.

API

To install modules:

springbok.initModules();

Modules are bound to the specified node in the DOM:

<div data-module="myNamespace.myWidget">
	<p>Initial widget content</p>
</div>

This <div> is send to the constructor of the module (so it can be set as view node).

Modules can also be installed one at a time:

springbok.initModule(viewNode, moduleName);

To uninstall modules:

springbok.destructModules();

This will call the destruct() method on each of the modules it finds (which makes the module itself responsible for cleaning up).

AMD

SpringbokJS is compatible with AMD setups:

<div data-module="modules/myWidget"></div>

Bring your own AMD loader: the require() function will be used to load the module.

Installation

  • Include springbok.js
  • Put data-module with module references in HTML
  • Make sure modules are objects that can be instantiated using new

Configuration options

<script>
	window.springbok = {
		autoload: true,
		context: document.getElementById('container'),
		anchor: 'data-widget'
	}
</script>

autoload: have Springbok initialize the modules after it is initialized (default: false)

context: the DOM node within modules are looked after (default: document.body)

anchor: the attribute referencing module (default: data-module)