From your examples, it looks like you're thinking more about helper
methods than just exposing the API, which makes sense, but then the
question is "what helper methods should we create to make this a good
framework?" (I think). If that's the case, have you thought about it
much? Helper method meaning something that wraps a chunk of air native
code up to support some reusable functionality beyond the lower level
air stuff.
- Jack
Andy Matthews wrote:
Jack...
I just blogged about this idea:
http://andymatthews.net/read/2009/06/12/jQuery-and-AIR:-AIR-methods-abstracted-into-jQuery-plugin
I think that this is a great idea and I'd love to get involved in it,
but I'd want others to be included as well. My jQuery foo is fairly
strong, but I've never written a plugin, and would really want someone
to provide a good code review for best practices. The cool thing is
that there wouldn't be much "jQuery" in the plugin. It's mostly an
abstraction of the AIR APIs into a tighter, simpler package.
I think the best place to start would be some of the lower hanging
fruit. Some of the API methods that are straightforward and don't
require a lot of options. Then we could move into SQLite, File System
access, etc.
Thoughts?
------------------------------------------------------------------------
*From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com]
*On Behalf Of *Jack Killpatrick
*Sent:* Friday, June 12, 2009 1:07 PM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] Re: AIR plugin for jQuery?
OK, yeah, that's what I figured you were looking for. I haven't seen
anything like that, but it would be cool if it existed. Doesn't seem
like it would be a "ton" of work (famous last words). Have you got any
thoughts about how it might work across the sandbox bridges? I use the
bridges and build the non-app sandbox stuff very much like a regular
web app and create and expose certain functions via the bridges
to/from the app and non-app sandbox, since all the direct air API
access can only happen in the app sandbox.
I haven't really thought it out, but wondering if maybe you have.
Maybe you're looking maybe for something that would just be used in
the app sandbox and it'd be up to the end user to create the bridge
stuff that they need?
- Jack
Andy Matthews wrote:
Thanks Jack...that's not quite what I meant.
For example, even though the AIR method for minimizing a window to the
system tray is short:
nativeWindow.minimize();
It would be cool if this functionality was packaged up so that you
could apply the minimize method directly to an object. Here's what I
do now:
// this assigns the minimize functionality to the minimize button
$('#minimize').bind('click', function(event) {
iface.minimize();
});
and here's how it could look:
// this assigns the minimize functionality to the minimize button
$('#minimize').air.minimize();
Obviously that's not a great example, but the code for adding a menu
to an icon running in the task bar is much lengthier. You can see how
this might benefit from an abstraction layer:
setupIconTray: function() {
// shortcut to the nativeApplication object
var app = air.NativeApplication.nativeApplication;
app.addEventListener(air.Event.COMPLETE, iconLoadComplete);
// create new instance of icon loader
var iconLoader = new air.Loader();
// these lines let me add a menu to the system tray.
// we're not going to use this for now, but I want to keep it
around
// icontray.menu = new air.NativeMenu();
// var exitCommand = icontray.menu.addItem(new air.NativeMenuItem
("Exit Bullhorn"));
// exitCommand.addEventListener(air.Event.SELECT, winmgr.close);
if(air.NativeApplication.supportsSystemTrayIcon){
iconLoader.contentLoaderInfo.addEventListener(air.Event.COMPLETE,
iconLoadComplete);
iconLoader.load(new air.URLRequest("images/AIRApp_16.png"));
app.icon.addEventListener
(window.runtime.flash.events.MouseEvent.CLICK, this.restore);
app.icon.tooltip = "Shrinkadoo";
// app.icon.menu = icontray.menu;
}
// if(air.NativeApplication.supportsMenu) {
// app.menu.addSubmenu(icontray.menu, "Windows");
function iconLoadComplete(event) {
app.icon.bitmaps = new runtime.Array
(event.target.content.bitmapData);
}
}
Anyway...I might start writing one, but would love to get input from
others who would be interested in helping out.
On Jun 12, 11:52 am, Jack Killpatrick <j...@ihwy.com> wrote:
This may be of interest, though it's not jQuery encapsulation, it does
provide an abstraction layer:
http://www.activerecordjs.org/index.html
I've been using the ActiveRecord js implementation in AIR for a while
now and it's proven to be solid so far:
http://www.activerecordjs.org/record.html
- Jack
Andy Matthews wrote:
Does anyone know of a plugin for jQuery that encapsulates some, or
all, of the AIR API?
andy