ng-snackbar.es6
Advanced tools
Comparing version 0.4.0 to 0.5.0
{ | ||
"name": "ng-snackbar.es6", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Snackbar angular.js module in ES6.", | ||
@@ -22,9 +22,10 @@ "main": "src/index.js", | ||
"concurrently": "^3.5.0", | ||
"css-loader": "^0.28.4", | ||
"express": "^4.15.3", | ||
"html-loader": "^0.4.5", | ||
"morgan": "^1.8.2", | ||
"nodemon": "^1.11.0", | ||
"morgan": "^1.8.2", | ||
"react": "^15.6.1", | ||
"react-dom": "^15.6.1", | ||
"css-loader": "^0.28.4", | ||
"html-loader": "^0.4.5", | ||
"react-router-dom": "^4.2.2", | ||
"style-loader": "^0.17.0", | ||
@@ -31,0 +32,0 @@ "url-loader": "^0.5.8", |
@@ -12,6 +12,14 @@ 'use strict'; | ||
app.get('*', (req, res, next)=>{ | ||
res.sendFile(path.join(__dirname, 'index.html')); | ||
app.get('/', (req, res, next)=>{ | ||
res.sendFile(path.join(__dirname, 'templates/index.html')); | ||
}); | ||
app.get('/ui-router*', (req, res, next)=>{ | ||
res.sendFile(path.join(__dirname, 'templates/ui-router/index.html')); | ||
}); | ||
app.get('/react-router*', (req, res, next)=>{ | ||
res.sendFile(path.join(__dirname, 'templates/react-router/index.html')); | ||
}); | ||
app.use((err, req, res, next)=>{ | ||
@@ -18,0 +26,0 @@ console.error(err); |
@@ -6,12 +6,13 @@ 'use strict'; | ||
export default (params={})=>{ | ||
/* | ||
** @param {string} params.directionFrom "top" or "bottom" (default: bottom) | ||
** @param {number} params.xi (default: -24) | ||
** @param {number} params.xf (default: 12) | ||
** @param {string} params.closeLabel (default: "DISMISS") | ||
** @param {number} params.duration (default: .75) | ||
** @param {string} params.router (default: 'ui-router', availables: 'ui-router' and 'react-router') | ||
**/ | ||
return class ErrorService { | ||
constructor($state) { | ||
constructor(routerMachine) { | ||
'ngInject'; | ||
/* | ||
** @param {string} params.directionFrom "top" or "bottom" (default: bottom) | ||
** @param {number} params.xi (default: -24) | ||
** @param {number} params.xf (default: 12) | ||
** @param {string} params.closeLabel (default: "DISMISS") | ||
** @param {number} params.duration (default: .75) | ||
**/ | ||
this.snackbar = null; | ||
@@ -21,3 +22,3 @@ this.content = null; | ||
this.closeBtn = null; | ||
this.$state = $state; | ||
this.routerMachine = routerMachine; | ||
this.directionFrom = params.directionFrom ? params.directionFrom : `bottom`; | ||
@@ -28,2 +29,3 @@ this.xi = params.xi !== undefined ? params.xi : -24; | ||
this.duration = params.duration ? params.duration : .75; | ||
this.router = params.router ? params.router : 'ui-router'; | ||
this.init(); | ||
@@ -45,10 +47,17 @@ } | ||
}, 1); | ||
if (args[0]) this.$state.go(args[0], args[1] ? args[1]: {}); | ||
if (args[0]) this.redirect(args[0], args[1] ? args[1]: {}); | ||
} | ||
redirect(stateName, stateParams={}) { | ||
redirect(...args) { | ||
/* | ||
** @param {string} stateName (required) | ||
** @param {object} stateParams (optional) | ||
** @param {string} args[0] (required) args[0] will be a state's name in ui-router | ||
** while a path url in react-router. | ||
** @param {object} args[1] (optional) args[1] works only if using ui-router. | ||
*/ | ||
this.$state.go(stateName, stateParams); | ||
if (this.router === 'ui-router') { | ||
this.routerMachine.go(args[0], args[1]); | ||
} else if (this.router === 'react-router') { | ||
this.routerMachine.push(args[0]); | ||
} else { | ||
throw Error(`Unavailable value for "params.router".`); | ||
} | ||
} | ||
@@ -55,0 +64,0 @@ remove() { |
@@ -8,3 +8,4 @@ 'use strict'; | ||
entry: { | ||
app: `./app/app.module.js`, | ||
[`ui-router-app`]: `./app/ui-router/app.module.js`, | ||
[`react-router-app`]: `./app/react-router/app.module.js`, | ||
}, | ||
@@ -11,0 +12,0 @@ output: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15084
21
460
17
1