**********
score.init
**********
.. _js_init:
.. image:: https://travis-ci.org/score-framework/js.init.svg?branch=master
:target: https://travis-ci.org/score-framework/js.init
This is the base module providing initialization helpers for all other modules.
It does exactly *nothing* on its own, except providing a function *extend*,
that can be used to, well, extend the originally useless object.
Quickstart
==========
Browser
-------
Just make sure this module is loaded before all other score modules:
.. code-block:: html
With require.js_
^^^^^^^^^^^^^^^^
.. code-block:: html
It is recommended to ``define()`` score with all its modules under a single URL
to make things more convenient:
.. code-block:: javascript
// in score.js
define(['score.init', 'score.dom'], function(score) {
return score;
});
.. code-block:: html
.. _require.js: http://requirejs.org/
Node.js_
--------
.. code-block:: javascript
var score = require('score.init'); require('score.oop');
score.oop.Class({
__name__: 'Bird'.
});
.. _Node.js: https://nodejs.org/
Details
=======
Extending
---------
Adding modules to *score* is as simple as calling *extend()*:
.. code-block:: html
The second parameter (the empty array), is a list of dependencies. If your
module need another module, it will not be available until all dependencies
were loaded:
.. code-block:: html
This behaviour has the effect, that you only need to make sure, that
``score.init`` is loaded before any other score modules. The loading order of
the other modules become irrelevant. This is important when using score in
the browser without require.js.
noConflict()
------------
It is possible, to remove the score variable from the global scope by using its
``noConflict()`` function:
.. code-block:: html
Acknowledgments
===============
Many thanks to BrowserStack_ and `Travis CI`_ for providing automated tests for
our open source projects! We wouldn't be able to maintain our high quality
standards without them!
.. _BrowserStack: https://www.browserstack.com
.. _Travis CI: https://travis-ci.org/