├── .gitignore ├── .npmignore ├── coverage ├── lcov-report │ ├── sort-arrow-sprite.png │ ├── prettify.css │ ├── index.html │ ├── wrist │ │ ├── index.html │ │ ├── wrist.js.html │ │ └── test.js.html │ ├── sorter.js │ ├── base.css │ └── prettify.js ├── lcov.info └── coverage.json ├── .travis.yml ├── examples ├── index.html ├── post.html ├── post.js ├── main.js ├── sync-model.html ├── sync-model.js └── SyncModel.js ├── test ├── index.html └── test.js ├── LICENSE.txt ├── package.json ├── wrist.min.js ├── README.md └── wrist.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/* -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .travis.yml 3 | .gitignore 4 | coverage/* 5 | examples/* 6 | node_modules/* 7 | test/* -------------------------------------------------------------------------------- /coverage/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebReflection/wrist/HEAD/coverage/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.12 4 | - 4 5 | - 6 6 | - 7 7 | git: 8 | depth: 1 9 | branches: 10 | only: 11 | - master 12 | after_success: 13 | - "npm run coveralls" 14 | -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 12 | 13 | 14 |dump36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wrist", 3 | "version": "0.0.3", 4 | "description": "Easy way to bind or react to properties change.", 5 | "main": "wrist.js", 6 | "devDependencies": { 7 | "coveralls": "^2.11.16", 8 | "istanbul": "^0.4.5", 9 | "jsdom": "^9.10.0", 10 | "tressa": "^0.2.0", 11 | "uglify-js": "^2.7.5" 12 | }, 13 | "scripts": { 14 | "build": "npm test && npm run minify && npm run size;", 15 | "test": "istanbul cover test/test.js", 16 | "minify": "uglifyjs wrist.js --comments=/^!/ --compress --mangle -o wrist.min.js", 17 | "size": "cat wrist.js | wc -c;cat wrist.min.js | wc -c;gzip -c wrist.min.js | wc -c", 18 | "coveralls": "cat ./coverage/lcov.info | coveralls" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/WebReflection/wrist.git" 23 | }, 24 | "keywords": [ 25 | "observer", 26 | "mutation", 27 | "watch", 28 | "unwatch", 29 | "react", 30 | "properties", 31 | "changes" 32 | ], 33 | "author": "Andrea Giammarchi", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/WebReflection/wrist/issues" 37 | }, 38 | "homepage": "https://github.com/WebReflection/wrist#readme" 39 | } 40 | -------------------------------------------------------------------------------- /examples/sync-model.js: -------------------------------------------------------------------------------- 1 | 2 | var model = { 3 | person : "bob" 4 | } 5 | 6 | var sel1; 7 | var twoWay; 8 | var oneWay; 9 | var clickOneWay; 10 | var dump; 11 | var killer; 12 | 13 | var sync 14 | 15 | function test(){ 16 | 17 | sel1 = document.getElementById("sel1"); 18 | twoWay = document.getElementById("twoWay"); 19 | oneWay = document.getElementById("oneWay"); 20 | clickOneWay = document.getElementById("clickOneWay"); 21 | clickOneWay.addEventListener("click", doOneWay) 22 | dump = document.getElementById("dump"); 23 | killer = document.getElementById("destroy"); 24 | killer.addEventListener("click", destroy) 25 | 26 | sync = new gieson.SyncModel({ 27 | model : model, 28 | callback : changed 29 | }); 30 | 31 | sync.link("person", sel1, "value"); 32 | sync.link("person", twoWay, "value"); 33 | sync.link("person", callme); 34 | 35 | } 36 | 37 | function changed(prop, prev, curr){ 38 | dump.innerHTML = JSON.stringify(model, true, "\t"); 39 | } 40 | 41 | function callme(prop, prev, curr) { 42 | oneWay.value = curr; 43 | } 44 | 45 | function doOneWay(e){ 46 | model.person = oneWay.value; 47 | } 48 | 49 | function destroy(){ 50 | sync.destroy(); 51 | sync = null; 52 | } 53 | 54 | document.addEventListener("DOMContentLoaded", test); 55 | 56 | try { console.log('try: model.person = "tom";'); } catch(o_O) {} 57 | 58 | -------------------------------------------------------------------------------- /wrist.min.js: -------------------------------------------------------------------------------- 1 | /*! (C) 2017 Andrea Giammarchi - MIT Style License */ 2 | var wrist=function(e){"use strict";function t(){}function n(e){var n=new t;return p.set(e,n),n}function r(e,t,n){var r=function(t){var r,l,i;if(this===e){if(f!==t)for(i=f,f=t,c.call(e,f),r=0,l=a.length;r
| File | 50 |51 | | Statements | 52 |53 | | Branches | 54 |55 | | Functions | 56 |57 | | Lines | 58 |59 | |
|---|---|---|---|---|---|---|---|---|---|
| wrist/ | 63 |98.33% | 65 |59/60 | 66 |86.96% | 67 |40/46 | 68 |92.31% | 69 |12/13 | 70 |98.25% | 71 |56/57 | 72 |
| File | 50 |51 | | Statements | 52 |53 | | Branches | 54 |55 | | Functions | 56 |57 | | Lines | 58 |59 | |
|---|---|---|---|---|---|---|---|---|---|
| wrist.js | 63 |98.33% | 65 |59/60 | 66 |86.96% | 67 |40/46 | 68 |92.31% | 69 |12/13 | 70 |98.25% | 71 |56/57 | 72 |