Skip to content

Instantly share code, notes, and snippets.

@Inviz
Last active December 12, 2015 01:48
Show Gist options
  • Save Inviz/4693368 to your computer and use it in GitHub Desktop.
Save Inviz/4693368 to your computer and use it in GitHub Desktop.
[submodule "color"]
path = color
url = https://github.com/kamicane/mootools-color
[submodule "lsd-specs"]
path = lsd-specs
url = https://github.com/lovelyscalabledrawings/lsd-specs
[submodule "lsd"]
path = lsd
url = https://github.com/lovelyscalabledrawings/lsd
[submodule "Sheet.js"]
path = Sheet.js
url = https://github.com/lovelyscalabledrawings/Sheet.js
[submodule "slick"]
path = slick
url = https://github.com/lovelyscalabledrawings/slick
[submodule "inflections"]
path = inflections
url = https://github.com/lovelyscalabledrawings/mootools-string-inflections.git
git submodule init
git submodule update
cd lsd-specs
./compile.sh
open Runner/index.html
var o = new LSD.Object({a: 1});
o.watch('a', function(value, old) {})
//fires callback with 1, undefined
o.set('a', 2);
// fires callback with 2, 1
var a = new LSD.Object;
a.merge(o)
// live merge objects
// a.a => 2
a.unmerge(o);
// a.a => undefined
o.unset('a')
// fires callback with undefined, 2
// a.a => undefined
var Widget = new Struct({
id: function(value, old) {
// transform value
if (value)
return value + 1;
},
name: function(value, old) {
this.set('id', value, old) // all modifications to name passed to id
},
title: 'alt', //redirect title -> alt
})
var widget = new Widget;
widget.set('name', 'Hey');
widget.id //Hey1
widget.unset('name')
widget.id //undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment