All Projects → GianlucaGuarini → Icaro

GianlucaGuarini / Icaro

Licence: mit
Smart and efficient javascript object observer, ideal for batching DOM updates (~1kb)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Icaro

Utility
Assign/Partial/ReadOnly/Proxy
Stars: ✭ 31 (-94.54%)
Mutual labels:  observable, proxy
Observer Util
Transparent reactivity with 100% language coverage. Made with ❤️ and ES6 Proxies.
Stars: ✭ 905 (+59.33%)
Mutual labels:  observable, proxy
Dob
Light and fast 🚀 state management tool using proxy.
Stars: ✭ 713 (+25.53%)
Mutual labels:  observable, proxy
Observable Slim
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.
Stars: ✭ 178 (-68.66%)
Mutual labels:  observable, proxy
Nsmartproxy
NSmartProxy是一款开源免费的内网穿透工具。采用.NET CORE的全异步模式打造。(NSmartProxy is an open source reverse proxy tool that creates a secure tunnel from a public endpoint to a locally service.)
Stars: ✭ 547 (-3.7%)
Mutual labels:  proxy
Awesome Anti Censorship
curated list of open-source anti-censorship tools
Stars: ✭ 521 (-8.27%)
Mutual labels:  proxy
Goproxy
A global proxy for Go modules.
Stars: ✭ 5,082 (+794.72%)
Mutual labels:  proxy
Gsnova
Private proxy solution & network troubleshooting tool.
Stars: ✭ 509 (-10.39%)
Mutual labels:  proxy
Goproxy
A minimalist Go module proxy handler.
Stars: ✭ 561 (-1.23%)
Mutual labels:  proxy
Nboost
NBoost is a scalable, search-api-boosting platform for deploying transformer models to improve the relevance of search results on different platforms (i.e. Elasticsearch)
Stars: ✭ 549 (-3.35%)
Mutual labels:  proxy
Leaf
A lightweight and fast proxy utility tries to include any useful features.
Stars: ✭ 530 (-6.69%)
Mutual labels:  proxy
Go Shadowsocks2
Experimental Shadowsocks in Go. Stable fork at https://github.com/shadowsocks/go-shadowsocks2
Stars: ✭ 530 (-6.69%)
Mutual labels:  proxy
Goproxy.cn
The most trusted Go module proxy in China.
Stars: ✭ 5,530 (+873.59%)
Mutual labels:  proxy
Deep Object Diff
Deep diffs two objects, including nested structures of arrays and objects, and returns the difference. ❄️
Stars: ✭ 515 (-9.33%)
Mutual labels:  object
Microsocks
tiny, portable SOCKS5 server with very moderate resource usage
Stars: ✭ 549 (-3.35%)
Mutual labels:  proxy
Weaver
An Advanced HTTP Reverse Proxy with Dynamic Sharding Strategies
Stars: ✭ 510 (-10.21%)
Mutual labels:  proxy
Proxymise
Chainable Promise Proxy
Stars: ✭ 537 (-5.46%)
Mutual labels:  proxy
Invoke Socksproxy
Socks proxy, and reverse socks server using powershell.
Stars: ✭ 540 (-4.93%)
Mutual labels:  proxy
Proxy
The Istio proxy components.
Stars: ✭ 533 (-6.16%)
Mutual labels:  proxy
Kubeadm Playbook
Fully fledged (HA) Kubernetes Cluster using official kubeadm, ansible and helm. Tested on RHEL/CentOS/Ubuntu with support of http_proxy, dashboard installed, ingress controller, heapster - using official helm charts
Stars: ✭ 533 (-6.16%)
Mutual labels:  proxy

icaro

A smart and efficient javascript object observer, ideal for batching DOM updates (~1kb)

Build Status NPM version NPM downloads MIT License

Installation

Via npm

$ npm i icaro -S

Script import

Via <script>

<script src='path/to/icaro.js'></script>

Via ES2015 modules

import icaro from 'icaro'

Via commonjs

const icaro = require('icaro')

Demos

Performance

icaro is really fast compared to the other reactive libs because it smartly throttles all the state changes.

Usage

icaro will let you listen to all the changes happening in a javascript object or array, grouping them efficiently, and optimizing the performance of your listeners.

const obj = icaro({})

// the variable "changes" here is a Map and the function is async
obj.listen(function(changes) {
  console.log(changes.get('foo')) // 'hi'
  console.log(changes.get('bar')) // 'there'
  console.log(changes.get('baz')) // 'dude'

  // kill all the listeners
  obj.unlisten()
})

obj.foo = 'hi'
obj.bar = 'there'
obj.baz = 'dude'

icaro will also let you listen to nested objects and all the non primitive properties added to an icaro object will be automatically converted into icaro observable objects.

const obj = icaro({})

// listen only the changes happening on the root object
obj.listen(function(changes) {
})

obj.nested = {

}

obj.nested.listen(function(changes) {
  // listen only the changes of obj.nested
})

obj.nested.someVal = 'hello'

icaro is able also to listen changes in arrays. Any change to the items indexes will dispatch events.

// Here a bit of hardcore async stuff

const arr = icaro([])

// here you will get the index of the items added or who changed their position
arr.listen(function(changes) {
  console.log(changes.get('0')) // 'foo'
  console.log(changes.get('1')) // 'bar'
  // kill all the listeners this included
  arr.unlisten()

  // add a brand new listener recursively.. why not?
  arr.listen(function(changes) {
    // the change was triggered by a 'reverse' and all indexes were updated
    console.log(changes.get('0')) // 'bar'
    console.log(changes.get('1')) // 'foo'
  })

  // update all the indexes
  arr.reverse()
})

// initial dispatch
arr.push('foo')
arr.push('bar')

You can also avoid unsubscribing ("unlisten") because icaro will automatically remove event listeners when the object is about to be garbage collected.

API

Any icaro call will return a Proxy with the following api methods

icaro.listen(callback)

Listen any object or array calling the callback function asynchronously grouping all the contiguous changes via setImmediate

@returns self

icaro.unlisten(callback|null)

Unsubscribing a callback previously subscribed to the object, if no callback is provided all the previous subscriptions will be cleared

@returns self

icaro.toJSON()

Return all data contained in an icaro Proxy as JSON object

@returns Object

Support

icaro uses advanced es6 features like Proxies, WeakMaps, Maps and Symbols and it targets only modern browsers

All major evergreen browsers (Edge, Chrome, Safari, Firefox) should be supported

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].