Skip to content

Instantly share code, notes, and snippets.

View pjrusso's full-sized avatar
🏠
Working from home

Paul Russo pjrusso

🏠
Working from home
  • Centinix Limited
  • United Kingdom
  • 21:12 (UTC +01:00)
View GitHub Profile
@pjrusso
pjrusso / two-way-binding.js
Created October 2, 2022 09:08 — forked from straker/two-way-binding.js
Simple and small two-way data binding between DOM and data
/**
* @param {object} scope - Object that all bound data will be attached to.
*/
function twoWayBind(scope) {
// a list of all bindings used in the DOM
// @example
// { 'person.name': [<input type="text" data-bind="person.name"/>] }
var bindings = {};
// each bindings old value to be compared for changes