**** BEGIN LOGGING AT Tue Oct 21 02:59:59 2014 Oct 21 16:22:45 hello Oct 21 16:23:31 morning Oct 21 16:23:56 life Oct 21 16:24:20 anyone know how i can reference the parent object from a kind put into component [] Oct 21 16:24:43 right now i have to do subcomponent.setParent(this) to pass in a reference Oct 21 16:25:05 Well Oct 21 16:25:14 let's say you have a Kind Parent Oct 21 16:25:20 in its component block Oct 21 16:25:24 you have a kind Child Oct 21 16:25:43 from within Child's code Oct 21 16:26:23 you can reference the owner with this.owner and the container with this.container Oct 21 16:26:38 The parent you are speaking about is normally the owner Oct 21 16:26:43 but not always Oct 21 16:27:07 the "owner" is the owner of the component block in which the kind was defined Oct 21 16:27:10 so for example Oct 21 16:27:24 if Parent had a components block that looked like this: Oct 21 16:27:30 components: [ Oct 21 16:27:40 { kind: "Child", components: [ Oct 21 16:27:49 { kind: "GrandChild" } Oct 21 16:27:52 ]} Oct 21 16:27:54 ]} Oct 21 16:28:04 ok Oct 21 16:28:08 so can i keep going up the chain? Oct 21 16:28:17 then Grandchild's this.owner would be Parent, and this.container would be Child Oct 21 16:28:19 i have an img inside a repeater inside a scroller etc Oct 21 16:29:06 What do you need the "parent" for? Oct 21 16:29:22 it has all the data Oct 21 16:29:36 its the top level app. i have stuff i ajaxed in there Oct 21 16:30:16 oh Oct 21 16:30:20 if it is the top level app Oct 21 16:30:26 then you don't even need this stuff XD Oct 21 16:30:33 is it an enyo.Application? Oct 21 16:31:10 im not sure. its just a a kind (control) that i instantiate in my html to star things off Oct 21 16:31:55 ah, well, if you make it into an enyo.Application, your life will be easier Oct 21 16:32:04 let me show you an example: Oct 21 16:36:51 ok googling this Oct 21 16:39:04 making a JSFiddle right now Oct 21 16:39:10 irc_smirk: http://jsfiddle.net/roncxt0c/ Oct 21 16:41:17 thanks Oct 21 16:41:20 yw Oct 21 16:41:28 so 'this.app' is available anywhere? Oct 21 16:41:46 it's available on any control that is within an app Oct 21 16:42:01 if it isn't in an app, I think this.app is undefined Oct 21 16:42:14 but then i still have to to owner if i have controls within controls right? Oct 21 16:42:20 and by in an app, I mean in an enyo.Application kind Oct 21 16:42:59 As long as those controls are within the enyo.Application, all of them will have this.app Oct 21 16:43:12 notice that Test doesn't have any reference to TestControl Oct 21 16:43:17 right but what if they have controls Oct 21 16:43:25 then owner.app ? Oct 21 16:43:32 but TestControl has this.app because it is in TestView, which is in Test Oct 21 16:44:06 if the owner has a this.app, then the kind that is owned will have a this.app as well Oct 21 16:44:32 ok ill check it out Oct 21 16:47:02 i dont think ive seen enyo.application in the docs at all Oct 21 16:47:20 im sure its in the api browser Oct 21 16:47:37 i like enyo but learning it has been a lot of googling work Oct 21 16:48:54 it's in the 2.4 docs IIRC Oct 21 16:48:59 let me find that section Oct 21 16:50:37 thanks. so what is best practice when building up seperate screens? Oct 21 16:51:06 irc_smirk: hrmm, I can't seem to find it in the docs either Oct 21 16:51:06 right now i putting it into panels. but this is just going to grow and grow Oct 21 16:51:30 irc_smirk: sugardave loves using Panels. They are definitely good if you want transitions Oct 21 16:51:48 irc_smirk: I tend to suggest switching views within the enyo.Application Oct 21 16:52:02 do things become instantiated or only when the panel is active? Oct 21 16:52:17 switch them how? Oct 21 16:52:21 with enyo.Panels, everything in it is instantiated Oct 21 16:52:37 I have a fiddle that shows how to do view switching in the enyo.Application, let me see if I can find it Oct 21 17:02:41 irc_smirk: I had a more recent example, but I haven't found it yet. Here is the first example I made for view switching: http://jsfiddle.net/09bhefc3/3/ Oct 21 17:04:02 ah yes thats cleaner Oct 21 17:04:12 so does it create and destory on switching? Oct 21 17:05:13 hrm Oct 21 17:06:03 I'm not sure about the destroy part Oct 21 17:06:14 since all I do is set the View to a new view Oct 21 17:06:32 however, I know that it creates that new view when you do the set Oct 21 17:06:40 (that's what the resetView variable is for) Oct 21 17:07:01 and it won't display the view unless you call this.render, which is why I call that after the set Oct 21 17:07:28 oh wait Oct 21 17:07:32 yes, the destroy happens Oct 21 17:07:38 it looks like viewChanged handles that Oct 21 17:07:44 hwo are you probing for that? Oct 21 17:07:49 from the API entry for viewChanged: "If a previous view exists and the controller is its owner, it will be destroyed; otherwise, it will simply be removed." Oct 21 17:08:22 oh ok Oct 21 17:09:56 probing? Oct 21 17:10:47 nevermind. i thought you had some code that put in listeners somewhere to detect it. but i guess you just read the docs Oct 21 17:11:38 ah yea Oct 21 17:12:42 Most of the best stuff I've learned about Enyo are things that I found out from the API or from reading the source Oct 21 17:12:49 ok lastly would it possible to skin enyo so it can do something like this Oct 21 17:13:12 http://www.idangero.us/framework7/kitchen-sink/ Oct 21 17:13:13 irc_smirk meant: ok lastly would it possible to skin enyo so it can do something like this Oct 21 17:13:47 lol Oct 21 17:13:50 yes Oct 21 17:14:01 that's just CSS stuff, so that wouldn't be hard at all Oct 21 17:14:02 thats a cool framework but it so buggy Oct 21 17:14:09 yeah i figured Oct 21 17:14:20 How your Enyo app looks is only limited by your skills at CSS :) Oct 21 17:14:28 just use their css and integrate somehow Oct 21 17:14:33 and by the limitations of CSS of course :P Oct 21 17:14:37 and thats pretty bad lol Oct 21 17:15:09 irc_smirk: their CSS might not be strictly portable Oct 21 17:15:24 I would cherry-pick rules you liked Oct 22 00:29:35 hello Oct 22 00:29:56 how would i go about having many components listen to one event Oct 22 00:30:04 use signals? Oct 22 00:30:16 don't return true in the event handler Oct 22 00:30:36 oh i see Oct 22 00:31:24 so my app has this {kind: "PlaylistModel", name:"playlistModel", onPlaylistLoaded:"_onPlaylistLoaded"}, Oct 22 00:31:51 how would some other component down the line register ot taht Oct 22 00:34:39 well, is it a model or will it contain child components? Oct 22 00:36:16 app -has-> playlistmodel app -has- playlistview i want app.playlistview to independently know about playlistmodel events so i can reuse it anywhere Oct 22 00:36:29 right now app listens to playlistmodel then tells playlistview Oct 22 00:37:10 ostensibly playlistview is built with the playlistmodel, so why not bind to a property there that you set in the model when getting the event? Oct 22 00:37:47 hrm didnt consider binding yet Oct 22 00:38:07 it makes life pretty easy Oct 22 00:38:40 so your saying something like playlsitmodel would have a property that would get 'dirty' and when that happens playlistview knows? Oct 22 00:38:48 yep Oct 22 00:39:27 so to decouple it, signals would be the other solution? Oct 22 00:40:30 btw thanks for this https://github.com/clinuz/college-football . printed it out and studying it Oct 22 00:41:29 it depends...you might be able to not return true in the model's handler and define a handlers: {"onPlayListLoaded": "theListHandler"} block Oct 22 00:42:00 irc_smirk: I don't think cole has updated that in a long time, but I haven't looked at it Oct 22 00:44:34 ok thanks Oct 22 00:50:58 its a mystery to me how enyo keeps track of all this stuff Oct 22 00:54:07 yeah playlist view cant detect that event with its own handler block Oct 22 00:55:13 then you can try to relay it via Signals, but I prefer bindings Oct 22 01:00:59 {from: ".$.slider.value", to: ".$.label.content"} // one-way binding Oct 22 01:01:13 does it have to have a hardcoded instance name? Oct 22 01:01:51 hrm. i think i need to think a bit higher level and define general event names and bind to that Oct 22 01:03:21 so, you have a model, and it is the model property of a view, the view can bind thusly: {from: ".model.someProperty", to: ".someViewProperty"} and then a someViewPropertyChanged function can do whatever Oct 22 01:03:40 and that goes where? in the view? Oct 22 01:03:51 yes Oct 22 01:04:03 bindings: [] // in there Oct 22 01:04:44 so its not .$.modelinstance? you can just the name of the kind? Oct 22 01:05:35 you read those from/to strings as having "this" appended, so my example is this.model. It assumes you have a property named model for that view Oct 22 01:06:18 notice there is no $ Oct 22 01:06:33 otherwise it would be this.$.model and be looking for a component named model Oct 22 01:06:39 ok Oct 22 01:06:49 thanks! Oct 22 01:06:52 np Oct 22 01:06:53 it is cleaner Oct 22 01:07:11 probably faster too Oct 22 01:07:18 no bubbling Oct 22 01:08:20 you can do pretty sophisticated stuff with bindings. you can set them to be two-way, you can transform the data flowing in and out. pretty sweet stuff Oct 22 01:09:56 so as an app grows, can one dynamically load in parts? say you tap on a row and you want a new view to come in from disk. can one load and eval enyo kinds at run time? Oct 22 01:11:03 t is possible, though something I never really learned how to do. it involves using enyo.path a lot. Check out the original Enyo 2 sampler app because it loads otherwise self-contained Enyo apps that way Oct 22 01:11:32 otherwise people jsut cram eveything into different panels etc? Oct 22 01:12:01 yes, but you can hold off creating those components until you need them, they just have to be known Oct 22 01:12:43 probably adding/removing to that components array must trigger instantiation and destruction of that object Oct 22 01:13:15 you'd have to do it via createComponent I'd think Oct 22 01:13:32 ok Oct 22 01:13:45 so you could build a system that read json bits from files to provide the kind definition and then use that with createComponent Oct 22 01:13:50 now if only we can get tags like poylmer we would have even more clarity in code Oct 22 01:13:57 yup **** ENDING LOGGING AT Wed Oct 22 03:00:00 2014