{"id":18739064,"url":"https://github.com/gaubee/binder","last_synced_at":"2025-11-18T12:30:15.588Z","repository":{"id":7770357,"uuid":"9139210","full_name":"Gaubee/Binder","owner":"Gaubee","description":"Association, and the trigger for complex data logic.","archived":false,"fork":false,"pushed_at":"2013-04-13T07:03:11.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T17:44:53.928Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gaubee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-01T01:53:45.000Z","updated_at":"2021-12-18T09:35:07.000Z","dependencies_parsed_at":"2022-09-13T14:01:27.171Z","dependency_job_id":null,"html_url":"https://github.com/Gaubee/Binder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2FBinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2FBinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2FBinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2FBinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gaubee","download_url":"https://codeload.github.com/Gaubee/Binder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239616731,"owners_count":19669099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T15:32:34.365Z","updated_at":"2025-11-18T12:30:15.546Z","avatar_url":"https://github.com/Gaubee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Binder.js 介绍 # \r\n_Model模块_\r\n_____________________\r\n\r\n## 版本号：v0.1.1 ##\r\n  \r\n  已经实现了对object类型和string、number、boolean类型的基本绑定功能\r\n  并对HTML元素的绑定（View Model）进行初步的特殊设定，并且会进一步完善VM模块\r\n  \r\n  -----------------------\r\n  \r\n## 快速开始 ##\r\n```javascript\r\nvar b = Binder(\"hello word\");\r\n```\r\n## 基本操作 ##\r\n```javascript\r\nvar b = Binder(\"Hello\");\r\nb.set(\"hi my lover\");\r\nb.get()  //Return\"hi my lover\"\r\n```\r\n## 绑定类型 ##\r\n* _简单类型(Single type)_ [number、string、boolean]\r\n* _复合对象(Object type)_\r\n* _功能对象(Function type)_\r\n\r\n```javascript\r\n//[number、string、boolean]\r\nvar sin = Binder(23);\r\n//Object\r\nvar obj = Binder({firstname:\"Gaubee\",lastname:\"bangeel\"});\r\n//HTML Object\r\n//bind model and it's key word for default update,and \"value\" is default currently\r\nvar firstname = Binder(document.getElementById(\"firstname\"),\"innerHTML\");\r\n//Function\r\nvar fullname = Binder(function(firstname,lastname){\r\n document.getElementById(\"fullname\") = firstname.value\r\n                                     + \" \"\r\n                                     + lastname.value;\r\n},[document.getElementById(\"firstname\"),document.getElementById(\"firstname\")]);\r\n```\r\n## 绑定操作 ##\r\n* 直接绑定\r\n* 监听绑定 _结构和功能未完善，建议直接使用 *直接绑定*_\r\n* 双向绑定 _结构和功能还在设计中_\r\n\r\n* 简单对象绑定\r\n\r\n```javascript\r\nvar str1 = Binder(\"hello word\");\r\nvar str2 = Binder(\"hi my love\");\r\nstr1.binding(str2);\r\nstr1.set(\"you are mine\");\r\nstr2.get();//still return \"hi my love\".Will not immediately change the binding is asynchronous,\r\nsetTimeout(function(){\r\n str2.get();//return \"you are mine\"\r\n},10);\r\n```\r\n* 复合对象绑定:\r\n\r\n```javascript\r\nvar firstname = Binder(document.getElementById(\"firstname\"));\r\nvar lastname = Binder(document.getElementById(\"lastname\"));\r\n//if run \".get()\",return document.getElementById(\"firstname\").value,\"value\" is default key\r\n\r\n//objbind-model,if firstname being changed,fullname will be changing too;\r\n//@Binder obj,if not,conver defaultly;\r\n//@[key word],string type,if not,it will take the key word when fitstname being init;\r\n//@[config],{ updateKey: null, weights: 0, forceUpdate: 0, compromise: false },\r\n //forceUpdate Means whether mandatory update already exists, even if the update history(update route table)\r\n //【DANGER, WARNING】,it may be cause an infinite loop,and continuously updated\r\nfirstname.binding(document.getElementById(\"fullname\"),{updateKey:[\"title\",\"innerHTML\"]});\r\n\r\n//and for lastname\r\nlastname.binding(document.getElementById(\"fullname\"),{updateKey:[\"title\",\"innerHTML\"]});\r\n//you could do that soon: \r\n //fullname.monitorList([firstname,lastname],[\"title\",\"innerHTML\"]);\r\n```\r\n* 计算功能绑定:\r\n\r\n```javascript\r\nvar fullname = Binder(function (n1,n2) {\r\n          document.getElementById(\"fullname\").innerHTML = n1.get() + \" \" + n2.get();\r\n      }, [firstname,lastname]);\r\n```\r\n\r\n\r\n# 实现方案\r\n\r\n## 初始化\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaubee%2Fbinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaubee%2Fbinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaubee%2Fbinder/lists"}