<commit_before># NajiDevJavaScriptDataBundle

This bundle integrates \NajiDev\Common\JavaScriptData\Container into your project in a nice way, for having a bridge to
get php variables to javascript. Take a look on the documentation of najidev/common.

## Installation

### Add bundle to composer.json

As composer is the standard way of Symfony to handle libraries and bundles, i'll only show the installation with
composer. In your composer.json add following:

  "require" : {
		"najidev/javascript-data-bundle" : "@dev"
	}

You should consider taking one of the releases instead of "@dev".

### Load the bundle in your Kernel

## Usage

The bundle creates the
service

	najidev.common.javascriptdata.container

in your DIC, which is an instance of

	\NajiDev\Common\JavaScriptData\Container

You just need to grab it by the DIC in your controller and use it:

	$this->get('najidev.common.javascriptdata.container')->set('my.key', 'value');

Another way to interact with the data-container is the templating
helper:

	$view['javascript_data']->set('my.key', 'value');

When the response is rendered, your container gets automatically injected (hiddent) to the end of your body, for
example:

		...
		<div id="javascript_data" style="display: none">
			{
				my : {
					key : "value"
				}
			}
		</div>
	</body

You can get this data with the helper.js. Be sure to use this helper, when the body was completely rendered. Jquerys
ready-event is just perfect for that:

	<script>
		$(document).ready(function()
		{
			var value = jsd.get('my.key', 'a default value, which will be returned if such key does not exist');

			console.log(value);
		});
	</script><commit_msg>some changes in the readme<commit_after># NajiDevJavaScriptDataBundle

This bundle integrates \NajiDev\Common\JavaScriptData\Container into your project in a nice way, for having a bridge to
get php variables to javascript. Take a look on the documentation of najidev/common.

## Installation

### Add bundle to composer.json

As composer is the standard way of Symfony to handle libraries and bundles, i'll only show the installation with
composer. In your composer.json add following:

  "require" : {
		"najidev/javascript-data-bundle" : "@dev"
	}

You should consider taking one of the releases instead of "@dev".

### Load the bundle in your Kernel

	$bundles = array(
		// your current bundles

		new \NajiDev\JavaScriptDataBundle\NajiDevJavaScriptDataBundle(),
	);

## Usage

The bundle creates the
service

	najidev.common.javascriptdata.container

in your DIC, which is an instance of

	\NajiDev\Common\JavaScriptData\Container

You just need to grab it by the DIC in your controller and use it:

	$this->get('najidev.common.javascriptdata.container')->set('my.key', 'value');

Another way to interact with the data-container is the templating
helper:

	$view['javascript_data']->set('my.key', 'value');

When the response is rendered, your container gets automatically injected (hidden) to the end of your body, for
example:

		...
		<div id="javascript_data" style="display: none">
			{
				my : {
					key : "value"
				}
			}
		</div>
	</body

You can get this data with the helper.js. Be sure to use this helper, when the body was completely rendered. Jquerys
ready-event is just perfect for that:

	<script>
		$(document).ready(function()
		{
			var value = jsd.get('my.key', 'a default value, which will be returned if such key does not exist');

			console.log(value);
		});
	</script>
{'fraction_non_alphanumeric': 0.0970063327576281, 'fraction_numerical': 0.0, 'mean_word_length': 4.007204610951009, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2385298', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1004, 'n_words': 414}