joomla/joomla-cms — pull request #1319 by Fedik (2013-06-22 13:11:44+00:00)
Title: [#31203] The one way and the one container for store the script options

In current state the developers add the script options as global variables via addScriptDeclaration, that can be not always safe, and not nice. This path allow to store options in the one global object, where the options separated by the extension name.
The options stays as array until header render, that allow to simple overwrite it if need.

Example add the script option:
```php
$options = array(
'showAlert' => false,
'consolelog' => true,
'text' => 'Hi! I am "Text"!',
'someArray' => array('one', 'two', 'and so on')
);
$doc->setScriptOptions($options, 'plg_examplejs');
```
Access to the options in frontend:
```javascript
Joomla.optionsStorage.plg_examplejs;
```