max-api-or-not
Version:
Error-free N4M outside of Max
37 lines (34 loc) • 626 B
JavaScript
let Max
const noMax = {
MESSAGE_TYPES: {
ALL: 'all',
BANG: 'bang',
DICT: 'dict',
NUMBER: 'number',
LIST: 'list'
},
POST_LEVELS: {
ERROR: 'error',
INFO: 'info',
WARN: 'warn'
},
addHandler: () => {},
addHandlers: () => {},
getDict: () => Promise.resolve({}),
outlet: () => {},
outletBang: () => {},
post: (c) => {console.log(c)},
registerShutdownHook: () => {},
removeHandler: () => {},
removeHandlers: () => {},
setDict: () => {},
updateDict: () => {},
__n4m_getRegisteredShutdownHook: () => {},
noMax: true,
}
try {
Max = require('max-api')
} catch(e) {
Max = noMax
}
module.exports = Max