Guy
Guy

Reputation: 13326

BackboneJS and JQuery plugins architecture playing together in a MiniPhotoshop project

I'm rather new with BackboneJS. it is exciting stuff for somebody who worked with plain JSONs until now. :) I am used to design JQuery Widgets and plugins to encapsulate logic / presentation. Backbone seems much more flexible with its MV* approach.

I am redesigning a "mini-photoshop" project for work. a javascript/html page which you can add elements like labels, images, buttons, change their properties, drag&drop them around and change their z-index, etc.

I took an approach of having a Backbone collection of elements that represents the drawing. I thought of using a jquery plugin to be able to create this workspace in everypage i'd like.

so i could do something like:

$('.wrapper').miniPhotoshop({
  elements:elements, // BB collection
  painter:painter    // an object that knows how to draw

});

the painter is seperated from plugin so i could easily change the way the collection is drawn.

So the objects here are:

My question is does this jquery-backbone salad make any sence?

Apologies if this is an open-ended question, just hoping someone tried something similar before and be able to point me in the right direction.

Thanks!

Upvotes: 0

Views: 220

Answers (1)

nebulousGirl
nebulousGirl

Reputation: 1364

I don't about others, but I wouldn't take jQuery for the structure of your app. I think Backbone is really good for structuring code, and jQuery is great for playing around with the dom.

My approach would be to use Backbone views to control the flow of your App and jQuery to play with/manipulate the dom inside Backbone views.

Upvotes: 2

Related Questions