I have a project in Backbone and Im using require js (I dont have to much experience with require this is my first project with it , actually).
Now. On my home.js view I have a lot of functions like this
iScroll: function () {
window.scrollers.myScroll = new iScroll(this.$('#products_container')[0], {
vScrollbar: true,
onScrollStart: function () {...........
swipeMobile: function () {
$("#mobile_view").swipe({
swipe: function (event, direction, distance, duration, fingerCount) {
if (direction == "left") {....
I want to put all this functions in one separated module forexample "plugins" and to call function I need in my home.js view when I need it .
Im loading my templates on home view like this
define([
'text!templates/about.html',
'text!templates/home.html',
'text!templates/product.html',
'text!templates/contact.html',
'collections/products'
],
function (aboutTemplate, homeTemplate, productTemplate, contactTemplate, Products) {
Whats the easiest way to do this ?