Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng-snackbar.es6

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-snackbar.es6 - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

app/app.config.js

28

package.json
{
"name": "ng-snackbar.es6",
"version": "0.1.1",
"version": "0.2.0",
"description": "Snackbar angular.js module in ES6.",
"main": "src/index.js",
"scripts": {
"build": "./node_modules/webpack/bin/webpack.js",
"watch": "./node_modules/webpack/bin/webpack.js --watch",
"test": "echo \"Error: no test specified\" && exit 1"
"start": "node server.js",
"postinstall": "npm run build",
"nodemon": "./node_modules/nodemon/bin/nodemon.js ./server.js",
"watch": "./node_modules/webpack/bin/webpack.js --watch --progress",
"build": "./node_modules/webpack/bin/webpack.js --progress",
"dev": "./node_modules/concurrently/src/main.js \"npm run nodemon\" \"npm run watch\""
},

@@ -14,6 +17,14 @@ "author": "ohpyupi",

"devDependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"@uirouter/react": "^0.5.0",
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-es2015": "^6.24.1",
"css-loader": "^0.28.1",
"babel-preset-react": "^6.24.1",
"concurrently": "^3.5.0",
"express": "^4.15.3",
"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",

@@ -23,3 +34,6 @@ "style-loader": "^0.17.0",

"webpack": "^2.5.1"
},
"dependencies": {
"dokebi": "^1.3.8"
}
}

@@ -16,7 +16,7 @@ # ng-snackbar.es6

*/
import uirouter from 'angular-ui-router';
import Snackbar from 'ng-snackbar.es6';
import angular from 'angular';
import uirouter from '@uirouter/angularjs';
angular.module('app', [uirouter])
.service('snackbar', Snackbar);
...
```

@@ -29,9 +29,12 @@

```
import Snackbar from 'ng-snackbar.es6';
export class HomeController {
constructor(snackbar) {
this.snackbar = snackbar;
}
testMethod() {
this.snackbar.flash("Hello world!");
}
constructor($state) {
this.snackbar = new Snackbar($state);
}
fetchUserData() {
...
this.snackbar.flash("Successfully loaded a user data!");
}
}

@@ -38,0 +41,0 @@ ```

'use strict';
import './style.css';
import Animator from './utils/animator';
import './styles.css';
import Animator from 'dokebi/services/accelerator';
export default class ErrorService {
constructor($state) {
constructor($state, params={}) {
'ngInject';
/*
** @param {string} params.directionFrom "top" or "bottom" (default: bottom)
** @param {number} params.xi (default: -24)
** @param {number} params.xf (default: 12)
**/
this.snackbar = null;

@@ -11,5 +16,9 @@ this.content = null;

this.closeBtn = null;
this.$state = $state;
this.directionFrom = params.directionFrom ? params.directionFrom : `bottom`;
this.xi = params.xi ? params.xi : -24;
this.xf = params.xf ? params.xf : 12;
this.closeLabel = params.closeLabel ? params.closeLabel : `DISMISS`;
this.duration = params.duration ? params.duration : .75;
this.init();
this.handleEventListeners();
this.$state = $state;
}

@@ -19,4 +28,4 @@ flash(message='', ...args) {

let body = document.getElementsByTagName('body')[0];
let bottomAnimator = new Animator(-24, 12, .75);
let opacityAnimator = new Animator(0, 1, .75);
let positionAnimator = new Animator(this.xi, this.xf, this.duration);
let opacityAnimator = new Animator(0, 1, this.duration);
body.appendChild(this.snackbar);

@@ -26,7 +35,7 @@ let degree = 0;

degree++;
let x = degree/10;
if (x > .75) return clearInterval(timer);
let x = degree/(100*this.duration);
if (x > this.duration) return clearInterval(timer);
this.snackbar.style.opacity = opacityAnimator.square(x);
this.snackbar.style.bottom = `${bottomAnimator.square(x)}px`;
}, 30);
this.snackbar.style[this.directionFrom] = `${positionAnimator.square(x)}px`;
}, 1);
if (args[0]) this.$state.go(args[0], args[1] ? args[1]: {});

@@ -36,9 +45,9 @@ }

let body = document.getElementsByTagName('body')[0];
let bottomAnimator = new Animator(12, -24, .75);
let opacityAnimator = new Animator(1, 0, .75);
let positionAnimator = new Animator(this.xf, this.xi, this.duration);
let opacityAnimator = new Animator(1, 0, this.duration);
let degree = 0;
let timer = setInterval(()=>{
degree++;
let x = degree/10;
if (x > .75) {
let x = degree/(100*this.duration);
if (x > this.duration) {
clearInterval(timer);

@@ -48,4 +57,4 @@ return body.removeChild(this.snackbar);

this.snackbar.style.opacity = opacityAnimator.square(x);
this.snackbar.style.bottom = `${bottomAnimator.square(x)}px`;
}, 30);
this.snackbar.style[this.directionFrom] = `${positionAnimator.square(x)}px`;
}, 1);
}

@@ -57,3 +66,3 @@ init() {

this.closeBtn = document.createElement('span');
this.closeBtn.innerHTML = 'DISMISS';
this.closeBtn.innerHTML = this.closeLabel;
this.content.appendChild(this.message);

@@ -66,2 +75,3 @@ this.content.appendChild(this.closeBtn);

this.closeBtn.className += 'snackbar-close-btn';
this.handleEventListeners();
}

@@ -68,0 +78,0 @@ handleEventListeners() {

@@ -8,3 +8,3 @@ 'use strict';

entry: {
main: './src/index.js',
app: `./app/app.module.js`,
},

@@ -29,3 +29,3 @@ output: {

query: {
presets: ['es2015']
presets: ['es2015', 'react']
}

@@ -32,0 +32,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc