UNPKG

generator-queo-gulp-starter

Version:

Scaffold out a front-end web app by using rcreate/gulp-starter package as dependency to build it

32 lines (25 loc) 753 B
window['jQuery'] = require('jquery') window['$'] = window['jQuery'] window['app'] = window.app || new function () { "use strict"; var self = this, instances = {} this.init = function(){ loadModule('example', 'body') } this.getInstance = function(name, selector) { return instances[name][selector.toString()] } this.getInstanceCollection = function(name) { return instances[name] } var loadModule = function (name, selector) { var $target = $(selector) if( $target.length ) { var module = require('./app/'+name) instances[name] = {} instances[name][selector.toString()] = new module($target) } } } window.app.init()