<commit_before>[![Build Status](https://travis-ci.org/ElliotNB/observable-slim.svg?branch=master)](https://travis-ci.org/ElliotNB/observable-slim)

# Observable Slim
https://github.com/elliotnb/observable-slim

Version 0.0.1.

Licensed under the MIT license:

http://www.opensource.org/licenses/MIT

## Overview 
Observable Slim is a singleton that utilizes ES6 Proxies to observe changes made to an object 
and any nested children of that object. It is intended to assist with state management and one-way 
data binding. Observable Slim aspires to be as lightweight and simple as possible. Minifies 
down to roughly 3000 characters.

## Usage


### Create an observer

The `create` method is the starting point for using Observable Slim. It is invoked to create a new ES6 Proxy 
whose changes we can observe. The `create` method accepts three parameters:

1. `target` - Object, required, plain JavaScript object that we want to observe for changes.
2. `domDelay` - Boolean, required, if true, then Observable Slim will batch up observed changes on a 10ms delay (`setTimeout) so a series of changes can be processed in one DOM update.
3. `observer` - Function, optional, will be invoked when a change is made to the proxy. When invoked, the `observer` function is passed a single argument -- an array detailing each change that has been made (see below).

The `create` method will return a standard ES6 Proxy.

```javascript
var test = {};
var p = ObservableSlim.create(test, true, function(changes) {
	console.log(JSON.stringify(changes));
});

p.hello = "world";   <commit_msg>README update<commit_after>[![Build Status](https://travis-ci.org/ElliotNB/observable-slim.svg?branch=master)](https://travis-ci.org/ElliotNB/observable-slim)

# Observable Slim
https://github.com/elliotnb/observable-slim

Version 0.0.1.

Licensed under the MIT license:

http://www.opensource.org/licenses/MIT

## Overview 
Observable Slim is a singleton that utilizes ES6 Proxies to observe changes made to an object 
and any nested children of that object. It is intended to assist with state management and one-way 
data binding. Observable Slim aspires to be as lightweight and simple as possible. Minifies 
down to roughly 3000 characters.

## Usage


### Create an observer

The `create` method is the starting point for using Observable Slim. It is invoked to create a new ES6 Proxy 
whose changes we can observe. The `create` method accepts three parameters:

1. `target` - Object, required, plain JavaScript object that we want to observe for changes.
2. `domDelay` - Boolean, required, if true, then Observable Slim will batch up observed changes to `target` on a 10ms delay (via `setTimeout`). If false, then `observer` will be immediately invoked after each individual change made to `target`. It is helpful to set `domDelay` to `true` when your `observer` function makes DOM manipulations (fewer DOM redraws means better performance).
3. `observer` - Function, optional, will be invoked when a change is made to the proxy of `target`. When invoked, the `observer` function is passed a single argument -- an array detailing each change that has been made (see below).

The `create` method will return a standard ES6 Proxy.

```javascript
var test = {};
var p = ObservableSlim.create(test, true, function(changes) {
	console.log(JSON.stringify(changes));
});

p.hello = "world";   
{'fraction_non_alphanumeric': 0.08600237247924081, 'fraction_numerical': 0.008896797153024912, 'mean_word_length': 4.484552845528455, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, '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': '2905687', 'n_tokens_mistral': 968, 'n_tokens_neox': 916, 'n_words': 434}