Update project structure

This commit is contained in:
gconsidine
2017-05-10 17:42:52 -04:00
parent 5553a6bcda
commit 725fd15519
82 changed files with 134 additions and 1078 deletions

View File

@@ -0,0 +1,38 @@
function addListeners (scope, list) {
let listeners = [];
list.forEach(args => {
listeners.push(addListener.call(null, scope, ...args));
});
return listeners;
}
function addListener (scope, el, name, fn, type) {
type = type || '$apply';
let listener = {
fn: () => scope[type](fn),
name,
el
};
listener.el.addEventListener(listener.name, listener.fn);
return listener;
}
function remove (listeners) {
listeners.forEach(listener => {
listener.el.removeEventListener(listener.name, listener.fn);
});
}
function EventService () {
return {
addListeners,
remove
};
}
export default EventService;

View File

@@ -0,0 +1,7 @@
import EventService from './event.service';
import PathService from './path.service';
angular
.module('at.lib.services', [])
.factory('EventService', EventService)
.factory('PathService', PathService);

View File

@@ -0,0 +1,16 @@
function getPartialPath (path) {
return `/static/partials/${path}.partial.html`;
}
function getViewPath (path) {
return `/static/views/${path}.view.html`;
}
function PathService () {
return {
getPartialPath,
getViewPath
};
}
export default PathService;