Commit 4fcfa04a authored by Leopoldthecoder's avatar Leopoldthecoder

relocate variable declaration

parent dcffbbbe
import Vue from 'vue';
var NotificationConstructor = Vue.extend(require('./main.vue'));
let NotificationConstructor = Vue.extend(require('./main.vue'));
var instance;
var instances = [];
var seed = 1;
let instance;
let instances = [];
let seed = 1;
var Notification = function(options) {
options = options || {};
var userOnClose = options.onClose;
var id = 'notification_' + seed++;
let userOnClose = options.onClose;
let id = 'notification_' + seed++;
options.onClose = function() {
Notification.close(id, userOnClose);
......@@ -23,8 +23,8 @@ var Notification = function(options) {
instance.vm.visible = true;
instance.dom = instance.vm.$el;
var topDist = 0;
for (var i = 0, len = instances.length; i < len; i++) {
let topDist = 0;
for (let i = 0, len = instances.length; i < len; i++) {
topDist += instances[i].$el.offsetHeight + 16;
}
topDist += 16;
......@@ -33,13 +33,15 @@ var Notification = function(options) {
};
Notification.close = function(id, userOnClose) {
let index;
let removedHeight;
for (var i = 0, len = instances.length; i < len; i++) {
if (id === instances[i].id) {
if (typeof userOnClose === 'function') {
userOnClose(instances[i]);
}
var index = i;
var removedHeight = instances[i].dom.offsetHeight;
index = i;
removedHeight = instances[i].dom.offsetHeight;
instances.splice(i, 1);
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment