How to create separate swipe module or class?

I need to use swipe detection in many places.

cc.Layer.extend({
    ....
    cc.eventManager.addListener(listener, this);
});

var listener = cc.EventListener.create ({ 
    event: cc.EventListener.TOUCH_ONE_BY_ONE,
    swallowTouches: true,
    onTouchBegan: function() {
    }
});

How can i keep it in seperate file and use it in different places?

Thanks for the help