daisho
Version:
Modular dashboard framework
35 lines (27 loc) • 731 B
text/coffeescript
import isFunction from 'es-is/function'
class MenuService
menu: null
menuHash: null
initFn: null
daisho: null
debug: false
constructor: (, ) ->
= []
= {}
register: (name, opts) ->
if [name]
console.log '---MENU SERVICE---\nCollision for ' + name
action = name
[name] =
name: name
action: action
icon: opts.icon
fn: if isFunction opts then opts else opts.action
.push [name]
run: (name) ->
return =>
data = [name]
if !data.action &&
console.log '---MENU SERVICE---\n' + name + ' not registered'
data.fn()
export default MenuService