state.html revision 1b298c6f0ef597aa4ab0b8bcb25430b6c9a87749
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen<script type="text/javascript" src="/build/yui.js"></script>
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen<script type="text/javascript" src="/src/js/State.js"></script>
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen // core: ['*']
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen// }).use('state', function(Y) {
3809b9691c46926aa54968ac8e418d04361e1efaTimo Sirainen// YUI({logExclude: {'Event': true}}).use('dump', 'state', function(Y) {
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo SirainenYUI({logInclude: {'Example': true}}).use('dump', 'state', function(Y) {
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen// YUI({logInclude: {}}).use('dump', 'state', function(Y) {
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen var newobj = {},
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo Sirainen { obj: "obj"},
da9f6acdcb303d0fe5160b669668aedf39c8f45aTimo Sirainen dat: new Date(),
da9f6acdcb303d0fe5160b669668aedf39c8f45aTimo Sirainen fn: function() {
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen //win: window,
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen var configs = new Y.State();
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen // add a prop
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen // show all attributes for this item
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen Y.log("myprop: " + Y.Lang.dump(configs.get('myprop')), 'info', 'Example');
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen // show a single attribute for this item
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen Y.log("myprop.str: " + configs.get('myprop', 'str'), 'info', 'Example');
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen // remove one or more attribute from the item (hash)
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen configs.remove('myprop', {fn: true});
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen Y.log("myprop-fn: " + Y.Lang.dump(configs.get('myprop')), 'info', 'Example');
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen // remove an attribute from the item (str)
8ab69d02c689fbdad2a1c83a5cd27e6adf21ca6cTimo Sirainen configs.remove('myprop', 'dat');
8ab69d02c689fbdad2a1c83a5cd27e6adf21ca6cTimo Sirainen Y.log("myprop-dat: " + Y.Lang.dump(configs.get('myprop')), 'info', 'Example');
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen // remove one or more attributes from the item (array)
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen configs.remove('myprop', ['nada']);
3809b9691c46926aa54968ac8e418d04361e1efaTimo Sirainen Y.log("myprop-nada: " + Y.Lang.dump(configs.get('myprop')), 'info', 'Example');
3809b9691c46926aa54968ac8e418d04361e1efaTimo Sirainen // add an attribute to an existing prop
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen configs.add('myprop', {nada:null});
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen Y.log("myprop+nada: " + Y.Lang.dump(configs.get('myprop')), 'info', 'Example');
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen // delete a property
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen Y.log("myprop deleted: " + Y.Lang.dump(configs.get('myprop')), 'info', 'Example');
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen configs.add('myprop', o2);
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen Y.log("myprop list: " + Y.Lang.dump(configs.list()), 'info', 'Example');
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen var Y = YUI();
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen function Main() {
Main.ATTRS = {
Main.PLUGINS = [
Aggr.NAME = "aggr";
Aggr.ATTRS = {
Aggr.PLUGINS = [
Y.aggregate(Main, Aggr, false, ["ATTRS", "PLUGINS"]);