These are chat archives for thinkingmedia/iChrome

30th
Nov 2015
Avi Kohn
@AMKohn
Nov 30 2015 20:35
Hi
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:35
Hello!
Avi Kohn
@AMKohn
Nov 30 2015 20:36
Did you get the Pro token?
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:36
That was quick.
Did you email it?
Avi Kohn
@AMKohn
Nov 30 2015 20:36
Yes
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:36
let me check
Avi Kohn
@AMKohn
Nov 30 2015 20:36
And added it to your sync profile.
I use Checker Plus for Gmail, so I get notifications
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:37
Cool, thanks. I'm about to run and catch a train.
So I'll look at that token later.
Avi Kohn
@AMKohn
Nov 30 2015 20:37
No problem.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:38
I'm trying to create a very simple widget that will show your public IP address.
Avi Kohn
@AMKohn
Nov 30 2015 20:38
It should sync in without you having to do anything.
I saw the branch name
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:38
I added the widget, but the view is not getting the model data.
So the view renders blank, but if I add the data via OnBeforeRender then it shows
Actually, I'll push what I have so far.
Avi Kohn
@AMKohn
Nov 30 2015 20:39
OK, I'll take a look
The data has to be under the data key name, which is linked to the data property of the view.
I see the issue
Data needs to be stored as a data object on the model. So you'd do this.saveData({ title: "Widget title" })
Or you can update the this.data property of the model and call this.saveData() to persist it.
Semantically, the data should be its own model, but I was worried about performance which is starting to become a bit of an issue across the app.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:44
what is the data is dynamic and doesn't need to be persistent?
Avi Kohn
@AMKohn
Nov 30 2015 20:44
Anything dynamic can be set directly on the model and accessed from the view by calling this.model.get("X"). Only a whitelist of attributes are handled
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:45
right, so in the model I call this.set('title','thing') then shouldn't {{title}} work in the template?
Avi Kohn
@AMKohn
Nov 30 2015 20:46
No. The widget model holds complete widget information, so it has size, state, data, config, syncData, and loc properties.
Data in the data attribute is stored locally and config and syncData are synced
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:47
ah okay. cool
it's working now, thanks :)
Avi Kohn
@AMKohn
Nov 30 2015 20:48
The system got more complex than I planned, so it's a bit of a jumble. I'll have to try to straighten things out at some point.
Great!
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:49
So I just wanted to play around with it, and see how easy it was to add some widgets.
Avi Kohn
@AMKohn
Nov 30 2015 20:49
Probably not too easy...
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:49
Working so far :)
I would like to see the status of my SABnzbd downloader that runs at home.
So I thought I'd add something like that as a widget and see if you like it.
Avi Kohn
@AMKohn
Nov 30 2015 20:50
I'm trying to keep the list of widgets relatively small until I can flesh out the directory more with things like categories and search.
It might be better/easier to use an iframe for something like that.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:51
Yeah, I noticed that. Was tempted to work on that actually.
but I figured I didn't know anything about the code to begin such a thing.
Avi Kohn
@AMKohn
Nov 30 2015 20:51
I've actually already worked up plans for it, but they're complicated.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:51
I can't use an iframe because there is no web end point to load.
Avi Kohn
@AMKohn
Nov 30 2015 20:51
How would you access data then?
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:52
It has an API/JSON end point. You need to configure an app token to use it.
You can control and manage all the downloads via the API
SABnzbd has a huge user base.
If you had something like that your user base would double in size quickly :clap:
Avi Kohn
@AMKohn
Nov 30 2015 20:53
It's command line only?
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:53
No it's a web API
Avi Kohn
@AMKohn
Nov 30 2015 20:54
So it has no interface?
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:54
No interface.
It has an interface, but you have to login via the web.
not exactly the best thing for an iframe
Avi Kohn
@AMKohn
Nov 30 2015 20:55
Can you hardcode your login information into the URL? (i.e. /login?user=name&pass=word)
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:55
no, i don't think so.
Avi Kohn
@AMKohn
Nov 30 2015 20:56
It would take a lot of work to build a fully-featured client for it.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:56
I guess the other option is to somehow support loading widgets from other git repos? kind of like NPM or Bower
Avi Kohn
@AMKohn
Nov 30 2015 20:56
That was the plan with the directory.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:56
cool
Avi Kohn
@AMKohn
Nov 30 2015 20:56
I modeled it around NPM, but with a review process.
But building it all out would take weeks.
The new widget system is also built to handle a RequireJS bundled widget, but I never tested it.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:57
No worries. Don't let me pressure you.
I will get busy with other stuff and disappear. So don't feel like you need to do anything extra.
Avi Kohn
@AMKohn
Nov 30 2015 20:58
I was thinking to eventually cache widget bundles the way themes are handled.
No problem.
But, I've been trying to wait until I can use a service worker so I don't have to keep track of cached bundles manually.
I built themes to do that, but it's a pain.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 20:59
I'll have to take a look at that.
I got to run. Time for train
Avi Kohn
@AMKohn
Nov 30 2015 21:00
If you're going to be working on a development version anyway, you could add it.
No problem.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 21:01
If you want to give me any kind of direction. Please feel free to add an issue and I'll pull requests on it when I can :)
Avi Kohn
@AMKohn
Nov 30 2015 21:01
You mean with the directory?
That's a while off. I have a calendar packed until January.
Avi Kohn
@AMKohn
Nov 30 2015 22:13
I just took a look at this again and realized we were talking about different things. I'd appreciate help on a directory system, but that's a lot of work and a long way off. My comment about working on a development version was regarding the SABnzbd widget, if you're planning on running a development version you can keep the widget local.
Mathew Foscarini
@thinkingmedia
Nov 30 2015 22:37
oh, that's an idea.
I could that. Can even make that widget have it's own repo mapped to just a directiry in the widgets folder.
I'll know more after I've finished this whatsmyip widget. That'll give me an idea of how complicated widgets are.