<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Brief episodes of technology, often in the presentation layer (webOS, html5, javascript, portals, etc) space.

- Ryan</description><title>technisode</title><generator>Tumblr (3.0; @technisode)</generator><link>http://blog.technisode.com/</link><item><title>Using Gravatar with Parse</title><description>&lt;p&gt;Gravatar is an service that allows users to specify a public avatar image linked to an email address. I recently decided to allow users to use their Gravatar avatar with my Parse-backed app rather than build in my own avatar system. To simplify things, I&amp;#8217;ve hooked beforeSave for the User object to hash the email address and add it to the object. That ensures that any email address change is automatically hashed on the server and allows me to send the hash down to clients rather than the email address to protect privacy.

&lt;pre&gt;&lt;code&gt;
function MD5(s){ /* one of many publicly available MD5 functions */ }

Parse.Cloud.beforeSave(Parse.User, function(request, response) {
    var email = request.object.get("email");
    request.object.set("emailHash", email? MD5(email) : "");
    response.success();
});
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;</description><link>http://blog.technisode.com/post/50012834367</link><guid>http://blog.technisode.com/post/50012834367</guid><pubDate>Thu, 09 May 2013 09:14:00 -0500</pubDate><category>parse</category><category>gravatar</category></item><item><title>EnyoJS Feature Request: appCache Support</title><description>&lt;p&gt;Obviously you can add appCache to existing apps but there are a couple things I think the framework could add here. First, let&amp;#8217;s get the appcache events wired into enyo&amp;#8217;s event model.

&lt;/p&gt;&lt;blockquote&gt;if(window.applicationCache) {
  enyo.dispatcher.listen(window.application, &amp;#8220;updateReady&amp;#8221;);
  // there are other cache states. updateReady seems to be the most useful one
}&lt;/blockquote&gt;

Second, let&amp;#8217;s enhance bootplate to include an appcache manifest in the index.html. Open to naming preferences. Also, provide the default manifest file. Here&amp;#8217;s a first cut

&lt;blockquote&gt;CACHE MANIFEST

# these will be cached
CACHE:
index.html
build/enyo.js
build/app.js
build/enyo.css
build/app.css
assets/*

# these resources will always be pulled from the network
NETWORK:
# /api

# these resources will be loaded if the requested fails
FALLBACK:
# tryFirst.html useOnFail.html&lt;/blockquote&gt;

Third, let&amp;#8217;s update the build scripts to (optionally) auto-update root/*.appcache with a build time so the manifest is reloaded whenever the app is built. Perhaps a hash of the contents of the build folder instead?</description><link>http://blog.technisode.com/post/48631381524</link><guid>http://blog.technisode.com/post/48631381524</guid><pubDate>Mon, 22 Apr 2013 14:53:40 -0500</pubDate><category>enyo</category></item><item><title>EnyoJS on Cloud9</title><description>&lt;p&gt;I&amp;#8217;ve been playing around with the Cloud9 IDE a bit recently to do some remote development. It&amp;#8217;s come a long way from when I first used it and is quite functional. A great addition is an interactive command line with a git client. So I thought, &amp;#8220;It&amp;#8217;d be nice to get the EnyoJS bootplate up and running here.&amp;#8221;  Following the &lt;a href="https://github.com/enyojs/enyo/wiki/Dupliforking" target="_blank"&gt;general instructions from the wiki&lt;/a&gt;, I put together a set of commands that gets everything set up.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;TL; DR&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Pull in bootplate, update the submodules, and &amp;#8220;disconnect&amp;#8221; the master branch from the bootplate repo.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git clone &lt;a href="https://github.com/enyojs/bootplate.git;" target="_blank"&gt;https://github.com/enyojs/bootplate.git;&lt;/a&gt; rm -rf .git; shopt -s dotglob; mv bootplate/* .; git remote rename origin bootplate; git submodule update --init; printf "\n.c9*" &amp;gt;&amp;gt; .gitignore; git add .gitignore; git config --unset branch.master.remote; git config --unset branch.master.merge;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Assuming your pushing this to a new git repo (on &lt;a href="http://github.com" target="_blank"&gt;Github&lt;/a&gt; or &lt;a href="http://bitbucket.org" target="_blank"&gt;Bitbucket&lt;/a&gt; for example), add the remote repo and set the master branch to track it.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
git remote add origin &lt;origin path&gt;
git fetch origin; git branch --set-upstream master origin/master&lt;/origin&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here&amp;#8217;s the first command broken up for readability:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
# clone the bootplate repo
git clone &lt;a href="https://github.com/enyojs/bootplate.git" target="_blank"&gt;https://github.com/enyojs/bootplate.git&lt;/a&gt;

# remove the existing git config (it'll be overwritten by bootplate)
rm -rf .git

# move the bootplate contents to the root folder (including the .git directory)
shopt -s dotglob
mv bootplate/* .

# rename the origin branch so your repo can be origin
git remote rename origin bootplate

# update the submodules
git submodule update --init

# add .c9* to .gitignore so the cloud9 revision tracker isn't added to git
printf "\n.c9*" &amp;gt;&amp;gt; .gitignore
git add .gitignore

# make master not track the remote bootplate repo
git config --unset branch.master.remote
git config --unset branch.master.merge
&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.technisode.com/post/45931956809</link><guid>http://blog.technisode.com/post/45931956809</guid><pubDate>Thu, 21 Mar 2013 15:11:04 -0500</pubDate></item><item><title>Sublime Text 2 Package for Enyo</title><description>&lt;p&gt;Since there seemed to be a little interest in my &lt;a href="https://gist.github.com/ryanjduffy/4574941" target="_blank"&gt;gist &lt;/a&gt;for create() override, I put together a few others that might be useful and dropped them into a new &lt;a href="https://github.com/ryanjduffy/enyo-st2" target="_blank"&gt;github repo&lt;/a&gt;. I also included a build system to kick off tools/deploy if you&amp;#8217;re using &lt;a href="http://github.com/enyojs/bootplate" target="_blank"&gt;bootplate&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you have Package Control, you can add the &lt;a href="https://github.com/ryanjduffy/enyo-st2" target="_blank"&gt;github repo&lt;/a&gt; as a custom repository and then install the package. If not, you can download the source/clone the repo into your Packages folder for Sublime.&lt;/p&gt;</description><link>http://blog.technisode.com/post/43545059417</link><guid>http://blog.technisode.com/post/43545059417</guid><pubDate>Tue, 19 Feb 2013 22:46:51 -0600</pubDate><category>enyo</category><category>sublimetext2</category></item><item><title>Enyo Extensions</title><description>&lt;p&gt;I have a couple extensions to Enyo that are in varying degrees of maturity that could use some external feedback and development. Below is a summary of each. If you&amp;#8217;re using these, something similar, or have some thoughts on where they should go, I&amp;#8217;d like to work with you to improve them. Feel free to comment below, catch me on twitter &lt;a href="http://twitter.com/theryanjduffy" target="_blank"&gt;@theryanjduffy&lt;/a&gt; or send an email to ryan@tiqtech.com.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;View State Framework&lt;/b&gt;&lt;br/&gt;
The view state framework is a relatively simple but extensible mechanism to manage the state of view controls. The definition of view control is loose but is intended to represent any control on which a user might expect to be able to “go back” to a previous state.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blog.technisode.com/post/35753883126/viewstate-framework" target="_blank"&gt;More &amp;#8230;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;RemoteControl&lt;/b&gt;&lt;br/&gt;
Retrieves a remote JS file and attempts to instantiate the specified kind as a child component. Provides a pluggable loading spinner. Seems like a building block for a single-page app (sub)framework but that needs some more thought.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blog.technisode.com/post/41331812157/enyo-remotecontrol" target="_blank"&gt;More &amp;#8230;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Platform-Aware Controls&lt;/b&gt;&lt;br/&gt;
Pattern/framework to enable native-feeling apps across different platforms by providing generalized components for common interactions.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://forums.enyojs.com/discussion/1203/platform-aware-controls#latest" target="_blank"&gt;More &amp;#8230;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.technisode.com/post/43079234610</link><guid>http://blog.technisode.com/post/43079234610</guid><pubDate>Thu, 14 Feb 2013 09:29:31 -0600</pubDate><category>enyo</category><category>enyo 2</category></item><item><title>enyo.RemoteControl</title><description>&lt;p&gt;Wanted to share a preview of a new kind I&amp;#8217;ve been working on. The idea stemmed from a recent patch I submitted to fix remote loading of js into enyo. A prime use case for that capbility is to deliver a mobile website in which the entire site could be integrated into a single enyo app without loading the entire source on load. Each view could be managed by a parent enyo.Panels and loaded as requested.

To support this idea, I created a new kind called enyo.RemoteControl. In short, it has a load() method that retrieves a remote JS file and attempts to instantiate the specified kind as a child component. To configure what to load, the kind has 2 design-time parameters: href to specify the URL and remoteKind to specify the &amp;#8220;kind&amp;#8221; to create. It also supports fit which tells the RemoteControl to apply the enyo-fit class to the new child. Finally, it provides a scrim and spinner which displays while the script is fetched and the kind is rendered. This can be overriden through the scrimKind member.

&lt;pre&gt;
enyo.kind({
	name:"enyo.RemoteControlScrim",
	kind:"onyx.Scrim",
	classes:"onyx-scrim-translucent",
	style:"text-align:center",
	showing:false,
	components:[
		{kind:"onyx.Spinner", style:"position:absolute;top:50%;margin-top:-30px;display:inline-block"}
	]
});

enyo.kind({
	name: "enyo.RemoteControl",
	kind: "Control",
	loadState: 0,
	scrimKind:"enyo.RemoteControlScrim",
	published:{
		animate:true
	},
	events:{
		onLoad:"",
		onLoadFailed:""
	},
	components:[
		{name:"ani", kind:"Animator", startValue:65, endValue:1, onStep:"aniStep", onStop:"aniStop", onEnd:"aniStop"}
	],
	getScrim:function() {
		// defer scrim creation ...
		return this.$.scrim || this.createComponent({name:"scrim", kind:this.scrimKind || "Control", owner:this}).render();
	},
	refresh: function() {
		this.setLoadState(0);
		this.load();
	},
	setLoadState:function(state) {
		this.loadState = state;
		if(this.loadState == 1) {
			this.getScrim().show();
		} else if(this.loadState == 2) {	// what about errors?
			if(this.animate) {
				this.$.ani.play();
			} else {
				this.aniStop();
			}
		}
	},
	load: function() {
		if(this.href &amp;amp;&amp;amp; this.loadState == 0) {
			this.setLoadState(1);
			//enyo.job(this.id+"_load", enyo.bind(this, function() {
				enyo.load([this.href], enyo.bind(this, "loaded"));
			//}), 2000);
		}
	},
	loaded: function(block) {
		// should be null unless my pull is changed to always created the failed member
		if(!block.failed || block.failed.length === 0) {
			this.setLoadState(2);
			this.remote = this.createComponent({kind:this.remoteKind, classes:(this.fit) ? "enyo-fit" : ""}).render();

			this.doLoad({remote:this.remote});
		} else {
			this.setLoadState(-1);
			this.doLoadFailed({failed:block.failed});
		}
	},
	aniStep:function(source) {
		this.getScrim().applyStyle("opacity", source.value/100)
	},
	aniStop:function(source) {
		this.getScrim().hide();
	}
});
&lt;/pre&gt;

To see it in action, check out &lt;a href="http://jsfiddle.net/ryanjduffy/EL9j4/" target="_blank"&gt;this fiddle&lt;/a&gt; which can remotely load several of the enyo samples as well as allowing you to provide your own details.&lt;/p&gt;</description><link>http://blog.technisode.com/post/41331812157</link><guid>http://blog.technisode.com/post/41331812157</guid><pubDate>Wed, 23 Jan 2013 21:16:34 -0600</pubDate><category>enyo 2</category><category>enyo</category></item><item><title>ViewState Framework</title><description>&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; Latest code available on &lt;a href="https://github.com/tiqtech/enyo-extras/tree/master/source/util" target="_blank"&gt;github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The view state framework is a relatively simple but extensible mechanism to manage the state of view controls. The definition of view control is loose but is intended to represent any control on which a user might expect to be able to &amp;#8220;go back&amp;#8221; to a previous state. The framework is not a view controller in MVC fashion but can be adapted to that purpose. I&amp;#8217;ve done just that by extending the enyo.Panels control.

&lt;/p&gt;&lt;p&gt;The view state framework has 3 components: enyo.ViewState, an implementation of ViewStateStrategy, and the consumer control.

&lt;/p&gt;&lt;p&gt;ViewState is the consumer API for the framework and consists of a single property, path, and two events, onSaveState and onRestoreState. Each instance of ViewState must declare a unique path (in the traditional /path/to/me format) but all paths need not be at the same depth. The intent is that you could have a view (path:&amp;#8221;/home&amp;#8221;) that contains additional views (path:&amp;#8221;/home/items&amp;#8221;) and their paths would represent that heirarchy. In addition to the semantic value, this also allows the framework to persist and restore states of any parent paths of the saved path. So, if you tell ViewState to save the state of /home/items, it will also trigger a save of /home via the onSaveState. Similarly, if the state of /home/items is restored, the state of /home is also restored (via onRestoreState).

&lt;/p&gt;&lt;p&gt;The management of view states is done through ViewStateStrategy instances. The ViewStateStrategy kind is basically an abstract base kind. It implements the API for strategies and provides some useful boilerplate code but doesn&amp;#8217;t store the state anywhere. The base API has three methods: push, pop, and register. As you might guess, push and pop are responsible for saving and restoring state, respectively. The register method associates a path with an instance of ViewState. This registration enables the magic of cascading save and restore described above.

&lt;/p&gt;&lt;p&gt;To get things started, I implemented a couple ViewStateStrategy instances that work well in the browser: HashViewStateStrategy and HistoryViewStateStrategy. HashViewStateStrategy leverages the window.location.hash to store state and window.onhashchange to trigger state restoration. To accomplish this, it includes a portion of the state data (the key member) in the hash following the path. It then parses the key out onhashchange and passes it back to the ViewState owner in the onRestoreState event.

&lt;/p&gt;&lt;p&gt;HistoryViewStateStrategy extends HashViewStateStrategy but uses the history API to store the state. This allows for more state data to be saved but still falls back to the key in the hash in absence of that state. This ensures that bookmarking the URL could still restore the application correctly.

&lt;/p&gt;&lt;blockquote&gt;&lt;div&gt;N.B. I tried a couple alteratives that leveraged the component heirarchy before landing on the register method approach. Event bubbling seemed to be the most promising but introduced a couple problems. One, events would bubble up from a ViewState to ancestor controls but couldn&amp;#8217;t waterfall down to aunt/uncle (to continue the metaphor) controls. It&amp;#8217;s easier to explain with a picture but, since it didn&amp;#8217;t work out, I won&amp;#8217;t bother. Second, it forced the path heirachy to match the control heirarchy. That&amp;#8217;s probably safe normally but didn&amp;#8217;t seem like a necessary constraint.&lt;/div&gt;&lt;/blockquote&gt;

&lt;p&gt;The consumer of ViewState has very little work. It must:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;create an instance of ViewState and  provide it a unique path,
&lt;/li&gt;&lt;li&gt;call enyo.ViewState.save when it wishes to save the state, 
&lt;/li&gt;&lt;li&gt;provide a handler for onRestoreState to update the control with the saved state, and
&lt;/li&gt;&lt;li&gt;optionally, provide a handler for onSaveState if other ViewState instances have a child path defined
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;That&amp;#8217;s it!

&lt;/p&gt;&lt;p&gt;More documentation to come but check out &lt;a href="http://tiqtech.com/gallery/viewstate.html" target="_blank"&gt;the example&lt;/a&gt; to see it in action.

&lt;/p&gt;&lt;p&gt;Thoughts/suggestions/questions? Let me know here or on twitter &lt;a href="http://twitter.com/theryanjduffy" target="_blank"&gt;@theryanjduffy&lt;/a&gt;.&lt;/p&gt;</description><link>http://blog.technisode.com/post/35753883126</link><guid>http://blog.technisode.com/post/35753883126</guid><pubDate>Wed, 14 Nov 2012 21:52:00 -0600</pubDate><category>enyo 2</category><category>enyo</category></item><item><title>Enyo Daily #26 - Controlling Item Selection in List</title><description>&lt;p&gt;By default, tapping a row in an Enyo list will &amp;#8220;select&amp;#8221; it.  Sometime you might want finer-grained control over when selection happens and this post will offer a means to accomplish just that.&lt;/p&gt;

&lt;p&gt;Selection is managed by an instance of enyo.Selection which is owned by the List control.  You can control how selection behaves via two passthrough properties on the List control:  &lt;code&gt;toggleSelected&lt;/code&gt; and &lt;code&gt;multiSelect&lt;/code&gt;.  &lt;/p&gt;

&lt;p&gt;&lt;code&gt;toggleSelected&lt;/code&gt; is false by default which means tapping the row will always select it.  By setting &lt;code&gt;toggleSelected&lt;/code&gt; to false, tapping the row will toggle the selection back and forth.  &lt;code&gt;multiSelect&lt;/code&gt; is also false by default which means only one row will be selected at a time.  By setting it to true, you can select multiple row (surprising, I know).&lt;/p&gt;

&lt;p&gt;When a row is selected or deselected, it is rerendered by the List and your onSetupItem handler is called.  In addition to an index property, the event will also have a selected property that reflects the current selection state of the row.  Alternatively, if you need to retrieve the selection state of the entire list, you can call getSelection() on the List to get a handle on its underlying Selection instance.&lt;/p&gt;

&lt;p&gt;Perhaps you&amp;#8217;ve decided to include interactive controls in your list item such as a checkbox or button and have decided that tapping those shouldn&amp;#8217;t trigger row selection.  Preventing the selection can use the same technique as triggering the selection:  the tap method.&lt;/p&gt;

&lt;p&gt;FlyweightRepeater does all the work for rendering list items using the flyweight pattern.  It also implements a tap() method to catch any taps on child nodes to trigger selection.  So, if you want to prevent selection, all you have to do is return true in your ontap handler to cancel bubbling thereby preventing the selection trigger.&lt;/p&gt;

&lt;p&gt;What if you had several buttons and only wanted one control (like a checkbox) to control selection?  Turns out that any subkind of Control can override tap() to handle ontap events (even without specifying an entry in your handlers hash!) because Control already declares the handler.  So, if you create a custom kind which implements tap() to return true, selection will never be triggered.  By adding a little exception logical to tap(), you can decide when selection occurs rather than on every tap.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a &lt;a href="http://jsfiddle.net/ryanjduffy/pbRXu/" target="_blank"&gt;working example&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
enyo.kind({
    name:"SimpleRow",
    kind:"Control",
    classes:"simple-row",
    published:{
        title:""
    },
    components:[
        {name:"cb", kind:"Button", content:"Select", ontap:"cbTapped"},
        {name:"title"}
    ],
    create:function() {
        this.inherited(arguments);
        this.titleChanged();
    },
    titleChanged:function() {
        this.$.title.setContent(this.title);
    },
    cbTapped:function(source, event) {
        // nothing magical about this property, just made it up
        event.allowBubble = true;
    },
    tap:function(source, event) {
        if(event.allowBubble) {
            event.allowBubble = false;
        } else {
            // cancel bubble without my special flag
            return true;
        }
    }
});

enyo.kind({
    name:"ex.App",
    components:[
        {kind:"List", toggleSelected:true, count:25, onSetupItem:"setupItem", components:[
            {name:"sr", kind:"SimpleRow"}
        ]}
    ],
    setupItem:function(source, event) {
        this.$.sr.setTitle("Item " + event.index);this.$.sr.addRemoveClass("selected", event.selected);
    }
});

new ex.App().renderInto(document.body);
​&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.technisode.com/post/27956719538</link><guid>http://blog.technisode.com/post/27956719538</guid><pubDate>Tue, 24 Jul 2012 22:24:00 -0500</pubDate><category>enyo daily</category><category>enyo</category><category>enyo 2</category></item><item><title>Enyo Daily #25 - Scrollable onyx.RichText</title><description>Here&amp;#8217;s a quick and easy way to make a scrollable multi-line input field. 

&lt;pre&gt;&lt;code&gt;
{kind: "extras.InputDecorator", alwaysLooksFocused:true, style:"width:100%;height:400px", components: [
    {kind:"Scroller", style:"height:100%;width:100%", components:[
        {name:"content", kind: "onyx.RichText", richContent:false, onchange: "inputChange", style:"min-height:100%"}
    ]}
]}
​&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You have to set the height of the input decorator (either explicitly or as a fit:true child of a FittableRows instance) as well as the width (either by setting the width or changing it to display:block).  By setting the min-height of the RichText control, you ensure that anywhere the user clicks in the area, the control will get focus but it will still expand if the user adds more content than the screen holds.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://jsfiddle.net/ryanjduffy/9Ee8U/" target="_blank"&gt;Live example on jsfiddle.net&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;N.B.  I&amp;#8217;ve used my extras.InputDecorator for the alwaysLooksFocused property but it works the same with vanilla onyx.InputDecorator.  &lt;/p&gt;</description><link>http://blog.technisode.com/post/27211504525</link><guid>http://blog.technisode.com/post/27211504525</guid><pubDate>Sat, 14 Jul 2012 15:21:00 -0500</pubDate><category>enyo</category><category>enyo daily</category><category>enyo 2</category></item><item><title>Enyo Daily #24 - Peeking CarouselArranger</title><description>&lt;p&gt;Here&amp;#8217;s a quick way to adapt the Panels CarouselArranger to peek the previous panel.  By setting peekWidth on the Panels instance, this modified arranger will offset the left by that amount.  It isn&amp;#8217;t a perfect implementation (e.g. you can see the prior panel in the background when you slide the current panel away) but it would probably work in many cases.&lt;/p&gt;
&lt;p&gt;For simplicity, the kind inherits from CarouselArranger.  I&amp;#8217;ve only modified the arrangeNoWrap method so the contents are virtually copied verbatim.  Look for &lt;strong&gt;peek&lt;/strong&gt; to find the customizations.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;enyo.kind({
    name: "extras.CarouselArranger",
    kind: "enyo.CarouselArranger",
    arrangeNoWrap: function(inC, inName) {
        var peek = this.container.peekWidth || 0;
        var c$ = this.container.children;
        var s = this.container.clamp(inName);
        var nw = this.containerBounds.width;
        // do we have enough content to fill the width?
        for (var i=s, cw=0, c; c=c$[i]; i++) {
            cw += c.width + c.marginWidth;
            if (cw &amp;gt; nw) {
                break;
            }
        }
        // if content width is less than needed, adjust starting point index and offset
        var n = nw - cw;
        var o = 0;
        if (n &amp;gt; 0) {
            var s1 = s;
            for (var i=s-1, aw=0, c; c=c$[i]; i--) {
                aw += c.width + c.marginWidth;
                if (n - aw &amp;lt;= 0) {
                    o = (n - aw);
                    s = i;
                    break;
                }
            }
        }
        // arrange starting from needed index with detected offset so we fill space
        for (var i=0, e=this.containerPadding.left + o + peek, w, c; c=c$[i]; i++) {
            w = c.width + c.marginWidth;
            if (i === s-1) {
                this.arrangeControl(c, {left: -w+peek});
            } else if (i &amp;lt; s) {
                this.arrangeControl(c, {left: -w});
            } else {
                this.arrangeControl(c, {left: Math.floor(e)});
                e += w;
            }
        }
    }
});&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.technisode.com/post/26808093504</link><guid>http://blog.technisode.com/post/26808093504</guid><pubDate>Sun, 08 Jul 2012 22:29:00 -0500</pubDate><category>enyo</category><category>enyo daily</category><category>enyo 2</category></item><item><title>Enyo Daily #23 - Memorable Panels</title><description>&lt;p&gt;This is very much beta code but wanted to share how to add history to the Enyo2 Panels control.  For flavor, I even added html5 history support so if you&amp;#8217;re using a Panels controls as the main view controller (like Pane in Enyo1), you get quick back button support.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s the code as well as a quick example (&lt;a href="http://fiddle.jshell.net/ryanjduffy/LnMmL/show/light/" target="_blank"&gt;full screen&lt;/a&gt; and in &lt;a href="http://jsfiddle.net/ryanjduffy/LnMmL/embedded/result/" target="_blank"&gt;jsfiddle&lt;/a&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;enyo.kind({
    name:"extras.Panels",
    kind:"enyo.Panels",
    published:{
        history:""
    },
    create:function() {
        this.historyChanged();
        this.inherited(arguments);
        this.createComponent({kind:"Signals", onBack:"back", onpopstate:"statePopped"});
        enyo.dispatcher.listen(window, "popstate");
    },
    historyChanged:function() {
        this.history = this.history || [];
    },
    back:function() {
        this.history.pop(); // current
        if(this.history.length &amp;gt; 0) {
            var last = this.history.pop();
            this.setIndex(last);
        }
    },
    indexChanged:function() {
        this.inherited(arguments);
        if(this.history[this.history.length-1] !== this.index) {
            this.pushState();
        }
    },
    pushState:function() {
        if(window.history.pushState) {
            var c = this.getControls();
            window.history.pushState({index:this.index}, "", "#"+c[this.index].name);
        }
        this.history.push(this.index);
    },
    statePopped:function(source, event) {
        if(event.state) {
            this.back();
        }
    }
});&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you&amp;#8217;re looking to support other browsers, you might check out &lt;a href="https://github.com/balupton/history.js" target="_blank"&gt;history.js&lt;/a&gt; which appears to be a nice polyfill for the history API.&lt;/p&gt;</description><link>http://blog.technisode.com/post/26734278275</link><guid>http://blog.technisode.com/post/26734278275</guid><pubDate>Sat, 07 Jul 2012 21:03:00 -0500</pubDate><category>enyo daily</category><category>enyo</category><category>enyo 2</category></item><item><title>Enyo Daily #22 - Always Focused Inputs</title><description>&lt;p&gt;In enyo v1, making an input control appear focused was easy: simply set alwaysLooksFocused to true.  In enyo v2, the styling is delegated to an InputDecorator but it doesn&amp;#8217;t provide this same property.  Fortunately, it&amp;#8217;s easy to add to a custom subkind.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;enyo.kind({
	name:"extras.InputDecorator",
	kind:"onyx.InputDecorator",
	published:{
		alwaysLooksFocused:false,
	},
	create:function() {
		this.inherited(arguments);
		this.alwaysLooksFocusedChanged();
	},
	alwaysLooksFocusedChanged:function() {
		this.addRemoveClass("onyx-focused", this.alwaysLooksFocused);
	},
	receiveBlur:function() {
		if(!this.alwaysLooksFocused) {
			this.inherited(arguments);
		}
	}
});&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.technisode.com/post/26296083119</link><guid>http://blog.technisode.com/post/26296083119</guid><pubDate>Sun, 01 Jul 2012 15:44:00 -0500</pubDate><category>enyo</category><category>enyo 2</category><category>enyo daily</category></item><item><title>Enyo Daily #21 - Enyo Style Tag</title><description>&lt;p&gt;Had a random idea to implement a &amp;lt;style&amp;gt; tag in Enyo for global runtime CSS manipulation.  I&amp;#8217;m thinking it might be handy to resize a bunch of elements as a result of window resize, for example.  I wrote a quick example in enyo v1 and ported the couple differences for v2.&lt;/p&gt;
&lt;p&gt;You can either set the entire CSS via its published css property or set individual blocks via the set(classSpec, styleObject) method.&lt;/p&gt;
&lt;p&gt;Thoughts?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt; Make a quick update to enable removing CSS from a selector by passing a null.  See the example below for removing the border from the children of .app.&lt;/p&gt;
&lt;p&gt;Here it is live:&lt;/p&gt;
&lt;p&gt;&lt;iframe frameborder="0" height="400px" src="http://jsfiddle.net/ryanjduffy/KAT2Z/2/embedded/"&gt;&lt;/iframe&gt;&lt;/p&gt;</description><link>http://blog.technisode.com/post/22499704545</link><guid>http://blog.technisode.com/post/22499704545</guid><pubDate>Sun, 06 May 2012 00:25:00 -0500</pubDate><category>enyo</category><category>enyo daily</category></item><item><title>Enyo Daily #20 - Frankenstein and Enyo</title><description>&lt;p&gt;CSS transitions are a really easy way to add basic animation to an enyo app.  It works on (seemingly) any CSS property and takes JavaScript out of the picture.   With Pirate&amp;#8217;s Dice (which is still not fully functional &amp;#8230;), I&amp;#8217;m using them to zoom the background when starting a new game.  I&amp;#8217;m also trying to support multiple resolutions (phones in portrait and landscape, tablets, and desktop) using media queries.&lt;!-- more --&gt;&lt;/p&gt;
&lt;p&gt;To accomplish this, I&amp;#8217;m scaling the background image differently for smaller screens than larger.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;

.animate {
    -webkit-transition:all 500ms ease-out;
}

/* portrait */

.app {
    background:#3e140c url(../image/bg.png) no-repeat 50% 100%;
    -webkit-background-size:auto 100%;
}

.app.new-game {
    -webkit-background-size:auto 200%;
}

/* landscape */
.app {
    -webkit-background-size:100% auto;
}

.app.new-game {
    -webkit-background-size:200% auto;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The consequence of this was that changing orientations of the phone would cause WebKit to animate the width from 100% to auto along with the height from auto to 100%.  This turns out to be a rather jarring experience.  To avoid this, I added a sprinkle of script to the resize handler that removes the animate class when resize starts and readds it once its complete.  enyo.job does the work of ensuring reanimate only runs once.  In other words, it won&amp;#8217;t be constantly added and readded as the window is resized such as on a desktop browser.&lt;/p&gt;
&lt;pre&gt;&lt;code class="javascript"&gt;
resizeHandler:function() {
    this.removeClass(“animate”);
    enyo.job(“frankenstein”, enyo.bind(this, “reanimate”), 200);
},
reanimate:function() {
    this.addClass(“animate”);
}
&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.technisode.com/post/19534054840</link><guid>http://blog.technisode.com/post/19534054840</guid><pubDate>Sun, 18 Mar 2012 16:15:00 -0500</pubDate><category>enyo daily</category><category>enyo</category></item><item><title>Enyo Daily #19 - Local Scrims</title><description>&lt;p&gt;There are two ways to create a scrim in enyo: globally through enyo.scrim or through the enyo.Scrim kind.  In either case, the scrim &amp;#8220;fades&amp;#8221; the entire view (usually in order to show a modal dialog or a spinner).  Another use case I&amp;#8217;m currently experimenting with in Pirate&amp;#8217;s Dice is a local scrim &amp;#8212; one that only fades a particular portion of the app.&lt;/p&gt;
&lt;p&gt;&lt;!-- more --&gt;In my case, I&amp;#8217;m using a scrim to disable the bid controls while other players are active.  I&amp;#8217;ve tried a few different approaches (including drawers, dialogs, and hiding the controls) but a scrim seems to be a nice and simple way to handle it.&lt;/p&gt;
&lt;p&gt;Making a scrim local is quite easy and mostly relies on a quick CSS customization.  First, create an instance of enyo.Scrim as a child of the control you wish to fade.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;enyo.kind({&lt;br/&gt;&lt;span&gt; &lt;/span&gt;name:&amp;#8221;ex.Hideable&amp;#8221;,&lt;br/&gt;&lt;span&gt; &lt;/span&gt;kind:&amp;#8221;Control&amp;#8221;,&lt;br/&gt;&lt;span&gt; &lt;/span&gt;className:&amp;#8221;extras-hideable&amp;#8221;,&lt;br/&gt;&lt;span&gt; &lt;/span&gt;components:[&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{name:&amp;#8221;count&amp;#8221;, content:&amp;#8221;Click Count: 0&amp;#8221;},&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{kind:&amp;#8221;Button&amp;#8221;, onclick:&amp;#8221;clicked&amp;#8221;},&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{name:&amp;#8221;scrim&amp;#8221;, kind:&amp;#8221;Scrim&amp;#8221;}&lt;br/&gt;&lt;span&gt; &lt;/span&gt;],&lt;br/&gt;});&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Notice I declared a className for the Control.  Next, I&amp;#8217;ll use that class name in css to limit the scrim to the bounds of my Hideable control.  By default, a scrim covers the screen by settings its position attribute to fixed.  To make it local, simply set the position of the parent control to relative and the scrim to absolute and you&amp;#8217;re set!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;.extras-hideable {&lt;br/&gt;&lt;span&gt; &lt;/span&gt;position:relative;&lt;br/&gt;}&lt;br/&gt;.extras-hideable .enyo-scrim {&lt;br/&gt;&lt;span&gt; &lt;/span&gt;position:absolute;&lt;br/&gt;}&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Finally, to show or hide the scrim, call the appropriate method on the scrim instance.  To illustrate, here&amp;#8217;s a silly example but it get&amp;#8217;s the point across.  Clicking on the button increments the count and changes the label.  Once the scrim is active (by clicking anywhere else in the control), clicking the button is blocked by the scrim.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;enyo.kind({&lt;br/&gt;&lt;span&gt; &lt;/span&gt;name:&amp;#8221;ex.Hideable&amp;#8221;,&lt;br/&gt;&lt;span&gt; &lt;/span&gt;kind:&amp;#8221;Control&amp;#8221;,&lt;br/&gt;&lt;span&gt; &lt;/span&gt;className:&amp;#8221;extras-hideable&amp;#8221;,&lt;br/&gt;&lt;span&gt; &lt;/span&gt;components:[&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{name:&amp;#8221;count&amp;#8221;, content:&amp;#8221;Click Count: 0&amp;#8221;},&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{kind:&amp;#8221;Button&amp;#8221;, onclick:&amp;#8221;clicked&amp;#8221;},&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{name:&amp;#8221;scrim&amp;#8221;, kind:&amp;#8221;Scrim&amp;#8221;}&lt;br/&gt;&lt;span&gt; &lt;/span&gt;],&lt;br/&gt;&lt;span&gt; &lt;/span&gt;create:function() {&lt;br/&gt;&lt;span&gt; &lt;/span&gt;this.inherited(arguments);&lt;br/&gt;&lt;span&gt; &lt;/span&gt;this.showing = false;&lt;br/&gt;&lt;span&gt; &lt;/span&gt;this.count = 0;&lt;br/&gt;&lt;span&gt; &lt;/span&gt;},&lt;br/&gt;&lt;span&gt; &lt;/span&gt;toggle:function() {&lt;br/&gt;&lt;span&gt; &lt;/span&gt;this.$.scrim[this.showing&amp;#160;? &amp;#8220;hide&amp;#8221;&amp;#160;: &amp;#8220;show&amp;#8221;]();&lt;br/&gt;&lt;span&gt; &lt;/span&gt;this.showing =&amp;#160;!this.showing;&lt;br/&gt;&lt;span&gt; &lt;/span&gt;},&lt;br/&gt;&lt;span&gt; &lt;/span&gt;clicked:function(source, event) {&lt;br/&gt;&lt;span&gt; &lt;/span&gt;this.count++;&lt;br/&gt;&lt;span&gt; &lt;/span&gt;this.$.count.setContent(&amp;#8220;Click Count: &amp;#8221; + this.count);&lt;br/&gt;&lt;span&gt; &lt;br/&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;event.stopPropagation();&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;/span&gt;}&lt;br/&gt;});&lt;br/&gt;&lt;br/&gt;enyo.kind({&lt;br/&gt;&lt;span&gt; &lt;/span&gt; name:&amp;#8221;ex.App&amp;#8221;,&lt;br/&gt;&lt;span&gt; &lt;/span&gt; kind:&amp;#8221;VFlexBox&amp;#8221;,&lt;br/&gt;&lt;span&gt; &lt;/span&gt; components:[&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{kind:&amp;#8221;ex.Hideable&amp;#8221;, flex:1, onclick:&amp;#8221;toggle&amp;#8221;},&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{kind:&amp;#8221;ex.Hideable&amp;#8221;, flex:1, onclick:&amp;#8221;toggle&amp;#8221;},&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{kind:&amp;#8221;ex.Hideable&amp;#8221;, flex:1, onclick:&amp;#8221;toggle&amp;#8221;},&lt;br/&gt;&lt;span&gt; &lt;/span&gt;{kind:&amp;#8221;ex.Hideable&amp;#8221;, flex:1, onclick:&amp;#8221;toggle&amp;#8221;}&lt;br/&gt;&lt;span&gt; &lt;/span&gt;],&lt;br/&gt;&lt;span&gt; &lt;/span&gt;lastRow:null,&lt;br/&gt;&lt;span&gt; &lt;/span&gt;toggle:function(source) {&lt;br/&gt;&lt;span&gt; &lt;/span&gt;if(source === this.lastRow) return;&lt;br/&gt;&lt;span&gt; &lt;/span&gt;if(this.lastRow) {&lt;br/&gt;&lt;span&gt; &lt;/span&gt;this.lastRow.toggle();&lt;br/&gt;&lt;span&gt; &lt;/span&gt;}&lt;br/&gt;&lt;span&gt; &lt;/span&gt;source.toggle();&lt;br/&gt;&lt;span&gt; &lt;/span&gt;this.lastRow = source;&lt;br/&gt;&lt;span&gt; &lt;/span&gt;},&lt;br/&gt;});&lt;br/&gt;&lt;br/&gt;new ex.App().renderInto(document.body);&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://blog.technisode.com/post/18090945064</link><guid>http://blog.technisode.com/post/18090945064</guid><pubDate>Wed, 22 Feb 2012 16:14:42 -0600</pubDate><category>enyo</category><category>enyo daily</category></item><item><title>Working on a new game for webOS (and possibly other platforms)...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lzs1q0Qjdy1qbnympo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Working on a new game for webOS (and possibly other platforms) called Pirate’s Dice.  I’m hoping to support both the classic rules of &lt;a href="http://en.wikipedia.org/wiki/Liar%27s_dice" target="_blank"&gt;Liar’s Dice&lt;/a&gt; as well a variation or two.  I have a playable alpha build working and am working on polish.  I’ll be looking for beta testers soon I hope so let me know in comments or via email [admin-at-tiqtech.com] if you’re interested.&lt;/p&gt;</description><link>http://blog.technisode.com/post/18054762656</link><guid>http://blog.technisode.com/post/18054762656</guid><pubDate>Tue, 21 Feb 2012 22:27:36 -0600</pubDate><category>webos</category><category>enyo</category><category>pirates dice</category></item><item><title>extras.Accordion</title><description>&lt;p&gt;Created a new Accordion control this evening in my &lt;a href="http://github.com/tiqtech/enyo-extras" target="_blank"&gt;enyo-extras repository&lt;/a&gt;.  If you&amp;#8217;re not familiar with this style control, jQuery has a &lt;a href="http://jqueryui.com/demos/accordion/" target="_blank"&gt;similar example&lt;/a&gt;.  Take a look and feel free to fork and make improvements!&lt;/p&gt;
&lt;p&gt;Next iteration will support scrolling content and horizontal display.&lt;/p&gt;</description><link>http://blog.technisode.com/post/16567165844</link><guid>http://blog.technisode.com/post/16567165844</guid><pubDate>Thu, 26 Jan 2012 23:50:44 -0600</pubDate><category>enyo</category><category>enyo extras</category></item><item><title>Enyo Daily #18 - Dynamic depends.js</title><description>&lt;p&gt;&lt;em&gt;While it&amp;#8217;s probably not fair to call this &amp;#8220;daily&amp;#8221; any longer, I&amp;#8217;m going to stick with it anyway.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You may have heard that &lt;a href="http://www.precentral.net/bing-maps-update-brings-enyo-support-webos-masses" target="_blank"&gt;enyo has found its way onto the legacy&lt;/a&gt; devices via a &lt;a href="http://blog.palm.com/palm/2011/10/a-new-view-of-the-world.html" target="_blank"&gt;new Maps application&lt;/a&gt; in the App Catalog.  To test things out, I tried to deploy &lt;a href="http://bit.ly/scorekeeper" target="_blank"&gt;Score Keeper&lt;/a&gt; onto my Pre2.  It deploys successfully but there are definitely some bugs to sort out.  One way I intend to clean up the UI is by including a phone-specific stylesheet through a dynamic depends.js file.&lt;/p&gt;
&lt;!-- more --&gt;
&lt;p&gt;The normal depends.js file looks something like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;enyo.depends(&lt;br/&gt;    &amp;#8220;controls.js&amp;#8221;,&lt;br/&gt;    &amp;#8220;app.js&amp;#8221;,&lt;br/&gt;    &amp;#8220;app.css&amp;#8221;&lt;br/&gt;);&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This tells enyo to load up controls.js, app.js, and app.css in the same directory as this depends.js file.  But depends.js is just a regular javascript file so there&amp;#8217;s nothing preventing you from doing something a little more robust here to select which files you want to include.  Also, since the framework is the one including depends.js in the first place, all the framework functions are available during execution of depends.js.&lt;/p&gt;
&lt;p&gt;I elected to use a closure to keep the global namespace clear and base my custom CSS inclusion on the screen width.  If you&amp;#8217;re aware of a better condition to check, please share in the comments.  Inside the function, I retrieve the device info and build an array of the common files.  Next, I check the device width and push the extra css if appropriate.  Finally, I call enyo.depends (via Function.apply since I&amp;#8217;m working with an array) and that&amp;#8217;s all!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;(function() {&lt;br/&gt;    var di = enyo.fetchDeviceInfo();&lt;br/&gt;    &lt;br/&gt;    var paths = [&amp;#8220;extras.js&amp;#8221;,&lt;br/&gt;                 &amp;#8220;views.js&amp;#8221;,&lt;br/&gt;                 &amp;#8220;app.css&amp;#8221;];&lt;br/&gt;    &lt;br/&gt;    if(di &amp;amp;&amp;amp; di.screenWidth &amp;lt; 500) {&lt;br/&gt;        paths.push(&amp;#8220;app-phone.css&amp;#8221;);&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;    enyo.depends.apply(enyo, paths);&lt;br/&gt;})();&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://blog.technisode.com/post/11466916557</link><guid>http://blog.technisode.com/post/11466916557</guid><pubDate>Fri, 14 Oct 2011 23:49:00 -0500</pubDate><category>enyo</category><category>webos</category><category>enyo daily</category></item><item><title>Enyo Daily #17 - Events - Part 5</title><description>&lt;p&gt;I wouldn&amp;#8217;t have expected to write so much about events in enyo but there&amp;#8217;s a lot of depth to cover.  I previously posted about an &lt;a href="http://blog.technisode.com/post/8545758113/enyo-daily-11-animated-grid-layout" target="_blank"&gt;Animated Grid Layout&lt;/a&gt; control I created which I later used in &lt;a href="http://developer.palm.com/appredirect/?packageid=com.tiqtech.scorekeeper" target="_blank"&gt;Score Keeper&lt;/a&gt; for the board selection.  I have a similar requirement for the main panes of &lt;a href="http://developer.palm.com/appredirect/?packageid=com.tiqtech.incontact" target="_blank"&gt;InContact &lt;/a&gt;but also need to reorder the items.&lt;!-- more --&gt;&lt;/p&gt;
&lt;p&gt;To enable the reordering, I wanted to defer the event handling to the new grid control rather than binding them in my app.  This keeps that logic contained to a separate control (one I could swap out for an alternate grid control if desired) and not muddling up my main app code.  The rub with this is that is was difficult to add an event handler to an enyo instance when you&amp;#8217;re not the owner of the control (in my scenario, the main app is the owner whereas the grid is just the container.  More on ownership and containment in &lt;a href="http://blog.technisode.com/post/7941076324/enyo-daily-3-ownership" target="_blank"&gt;Enyo Daily 3&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The rather simple solution I discovered was to add an instance function to the enyo instance during creation.  The function is bound (using enyo.bind) to the grid control so it can enable reordering.&lt;/p&gt;
&lt;p&gt;One caution with this approach is that it will by default prevent calling a handler declared for the onX event for the instance.  You could call dispatchIndirectly yourself in your instance method but I&amp;#8217;ll leave that as homework.  :)&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s a quick example.  I&amp;#8217;ll share the reorderable grid control once it&amp;#8217;s actually complete!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;var _Example = {&lt;br/&gt;    name:&amp;#8221;com.technisode.example.App&amp;#8221;,&lt;br/&gt;    kind:&amp;#8221;Control&amp;#8221;,&lt;br/&gt;    components:[&lt;br/&gt;        {kind:&amp;#8221;ApplicationEvents&amp;#8221;, name:&amp;#8221;appEvents&amp;#8221;, onUnload:&amp;#8221;logAppEvent&amp;#8221;},&lt;br/&gt;        {kind:&amp;#8221;EventSender&amp;#8221;, name:&amp;#8221;eventSender&amp;#8221;, onSend:&amp;#8221;sent&amp;#8221;},&lt;br/&gt;        {kind:&amp;#8221;Button&amp;#8221;, onclick:&amp;#8221;clicked&amp;#8221;},&lt;br/&gt;        {kind:&amp;#8221;ContainerListener&amp;#8221;, components:[&lt;br/&gt;            {kind:&amp;#8221;Button&amp;#8221;, caption:&amp;#8221;Clicking me will be handled by my container&amp;#8221;}&lt;br/&gt;        ]},&lt;br/&gt;        {kind:&amp;#8221;Input&amp;#8221;, onkeypress:&amp;#8221;press&amp;#8221;},&lt;br/&gt;        {kind:&amp;#8221;Dashboard&amp;#8221;, name:&amp;#8221;db&amp;#8221;}&lt;br/&gt;    ],&lt;br/&gt;    create:function() {&lt;br/&gt;        this.inherited(arguments);&lt;br/&gt;        &lt;br/&gt;        this.$.db.setLayers([{title:&amp;#8221;My Dashboard&amp;#8221;, text:&amp;#8221;important message&amp;#8221;}]);&lt;br/&gt;        &lt;br/&gt;        // map all ApplicationEvents to logAppEvent&lt;br/&gt;        var ae = this.$.appEvents;&lt;br/&gt;        Object.keys(enyo.ApplicationEvents.prototype.events).forEach(function(key) {&lt;br/&gt;            //enyo.log(&amp;#8220;setting handler for &amp;#8220;,key);&lt;br/&gt;            ae[key] = &amp;#8220;logAppEvent&amp;#8221;;&lt;br/&gt;        });&lt;br/&gt;        &lt;br/&gt;        enyo.dispatcher.rootHandler.addListener(this);&lt;br/&gt;    },&lt;br/&gt;    logAppEvent:function(source, e) {&lt;br/&gt;        enyo.log(&amp;#8220;logAppEvent&amp;#8221;,e.type);&lt;br/&gt;    },&lt;br/&gt;    resizeHandler:function() {&lt;br/&gt;        enyo.log(&amp;#8220;dimensions&amp;#8221;,window.document.body.offsetWidth,window.document.body.offsetHeight);&lt;br/&gt;    },&lt;br/&gt;    captureDomEvent:function(e) {&lt;br/&gt;        enyo.log(&amp;#8220;A DOM event occured&amp;#8221;, e.type);&lt;br/&gt;        &lt;br/&gt;        // returning true would indicated the event is captured and prevent the bubble phase&lt;br/&gt;        // thereby preventing the declared handlers (clicked in this case) from being called&lt;br/&gt;        &lt;br/&gt;        // returning false (or no explicit return) lets things continue&lt;br/&gt;        return false;&lt;br/&gt;    },&lt;br/&gt;    dispatchDomEvent:function(e) {&lt;br/&gt;        // like any other method, you could override dispatchDomEvent and implement custom routing&lt;br/&gt;        e.myCustomField = &amp;#8220;This is a custom field&amp;#8221;;&lt;br/&gt;        &lt;br/&gt;        return this.inherited(arguments);&lt;br/&gt;    },&lt;br/&gt;    press:function(source, event) {&lt;br/&gt;        enyo.log(source, event);&lt;br/&gt;    },&lt;br/&gt;    clickHandler:function(source, event) {&lt;br/&gt;        enyo.log(&amp;#8220;bubbled up to me&amp;#8221;, event.myCustomField);&lt;br/&gt;        &lt;br/&gt;        // calling event.stopPropagation() or returning true will end the bubble phase&lt;br/&gt;    },&lt;br/&gt;    clicked:function(source, event) {&lt;br/&gt;        // trigger my custom events&lt;br/&gt;        this.$.eventSender.go();&lt;br/&gt;        &lt;br/&gt;        // toggles event handler between send and secondSent &amp;#8230; just because &amp;#8230;&lt;br/&gt;        this.$.eventSender.onSend = (this.$.eventSender.onSend === &amp;#8220;sent&amp;#8221;)&amp;#160;? &amp;#8220;secondSent&amp;#8221;&amp;#160;: &amp;#8220;sent&amp;#8221;;&lt;br/&gt;        &lt;br/&gt;        // calling event.stopPropagation() or returning true will end the bubble phase&lt;br/&gt;    },&lt;br/&gt;    sent:function(source, one, two, three) {&lt;br/&gt;        enyo.log(&amp;#8220;sent&amp;#8221;, one, two, three)&lt;br/&gt;    },&lt;br/&gt;    handleOnAlert:function(source, obj) {&lt;br/&gt;        enyo.log(&amp;#8220;alerted&amp;#8221;, enyo.json.stringify(obj));&lt;br/&gt;    },&lt;br/&gt;    secondSent:function(source, one, two, three) {&lt;br/&gt;        enyo.log(&amp;#8220;secondSent handles onSend now&amp;#8221;, one, two, three)&lt;br/&gt;    },&lt;br/&gt;    customGlobalEventHandler:function(sender, param) {&lt;br/&gt;        enyo.log(&amp;#8220;customGlobalEvent&amp;#8221;, param.data);&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;var _ContainerListener = {&lt;br/&gt;    name:&amp;#8221;ContainerListener&amp;#8221;,&lt;br/&gt;    kind:&amp;#8221;Control&amp;#8221;,&lt;br/&gt;    createComponent:function() {&lt;br/&gt;        var o = this.inherited(arguments);&lt;br/&gt;        o.clickHandler = enyo.bind(this, &amp;#8220;childClicked&amp;#8221;);&lt;br/&gt;        return o;&lt;br/&gt;    },&lt;br/&gt;    childClicked:function(source, event) {&lt;br/&gt;        enyo.log(&amp;#8220;one of my child nodes was clicked!&amp;#8221;)&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;var _EventSender = {&lt;br/&gt;    name:&amp;#8221;EventSender&amp;#8221;,&lt;br/&gt;    kind:&amp;#8221;Component&amp;#8221;,&lt;br/&gt;    events:{ &lt;br/&gt;        onSend:&amp;#8221;handleOnSend&amp;#8221;,&lt;br/&gt;        onAlert:{value:&amp;#8221;handleOnAlert&amp;#8221;, caller:&amp;#8221;sendAlert&amp;#8221;}&lt;br/&gt;    },&lt;br/&gt;    create:function() {&lt;br/&gt;        this.inherited(arguments);&lt;br/&gt;        &lt;br/&gt;        enyo.dispatcher.rootHandler.addListener(this);&lt;br/&gt;    },&lt;br/&gt;    go:function() {&lt;br/&gt;        this.doSend(1,2,3);    // dispatchIndirectly&lt;br/&gt;        this.sendAlert({a:1, b:2});&lt;br/&gt;        window.enyo.dispatch({type:&amp;#8221;customGlobalEvent&amp;#8221;, data:&amp;#8221;something to pass&amp;#8221;});&lt;br/&gt;    },&lt;br/&gt;    customGlobalEventHandler:function(sender, e) {&lt;br/&gt;        enyo.log(&amp;#8220;also caught customGlobalEvent&amp;#8221;);&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;enyo.kind(_ContainerListener);&lt;br/&gt;enyo.kind(_EventSender);&lt;br/&gt;enyo.kind(_Example);&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://blog.technisode.com/post/10431858157</link><guid>http://blog.technisode.com/post/10431858157</guid><pubDate>Mon, 19 Sep 2011 22:40:00 -0500</pubDate><category>enyo</category><category>webos</category><category>enyo daily</category></item><item><title>Score Keeper
Had to take some time away from my Enyo Daily...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_lrhrctel531qbnympo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;strong&gt;Score Keeper&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Had to take some time away from my Enyo Daily series to actually finish up my first Touchpad app!!  It’s called Score Keeper and, as the name implies, it helps you keep track of the score for a game or activity.  I just submitted it to the catalog and should be available soon.  You’ll find it &lt;a target="_blank" href="http://developer.palm.com/appredirect/?packageid=com.tiqtech.scorekeeper"&gt;here &lt;/a&gt;once it’s available.&lt;/p&gt;</description><link>http://blog.technisode.com/post/10189564060</link><guid>http://blog.technisode.com/post/10189564060</guid><pubDate>Tue, 13 Sep 2011 21:38:00 -0500</pubDate><category>webos</category><category>enyo</category><category>touchpad</category><category>Score Keeper</category></item></channel></rss>
