vue-easter-egg-trigger
Advanced tools
Comparing version 0.1.16 to 0.1.17
{ | ||
"name": "vue-easter-egg-trigger", | ||
"version": "0.1.16", | ||
"version": "0.1.17", | ||
"description": "This packages makes it nice and easy to add Easter Egg triggers to your Vue site.", | ||
"private": false, | ||
"main": "dist/index.js", | ||
"main": "dist/vue-easter-egg-trigger.js", | ||
"types": "types/index.d.ts", | ||
@@ -8,0 +8,0 @@ "scripts": { |
@@ -1,4 +0,4 @@ | ||
import EasterEggTrigger from '@plugins/EasterEggTrigger' | ||
import EasterEggTrigger from '@plugins/EasterEggTrigger'; | ||
export const version = '__VERSION__' | ||
export const version = '__VERSION__'; | ||
@@ -10,2 +10,2 @@ // Automatic installation if Vue has been added to the global scope. | ||
export default EasterEggTrigger | ||
export default EasterEggTrigger; |
@@ -14,12 +14,7 @@ import EasterEggTriggerCore from './EasterEggTriggerCore'; | ||
Vue.prototype.$easterEgg = function(eggOptions) { | ||
const pluginOptions = EasterEggTrigger.options; | ||
EasterEggTriggerCore.init(Vue, pluginOptions, eggOptions); | ||
EasterEggTriggerCore.init(EasterEggTrigger.options, eggOptions); | ||
}; | ||
Vue.prototype.$easterEggTrigger = function(eggOptions) { | ||
const pluginOptions = EasterEggTrigger.options; | ||
EasterEggTriggerCore.init(Vue, pluginOptions, eggOptions); | ||
// plugin.setEggOptions(methodOptions); | ||
// plugin.callAddListener(); | ||
EasterEggTriggerCore.init(EasterEggTrigger.options, eggOptions); | ||
}; | ||
@@ -26,0 +21,0 @@ }, |
@@ -16,24 +16,10 @@ import Vue from 'vue'; | ||
// Options // | ||
defaultOptions: { | ||
egg: { | ||
callback: null, | ||
destroyBus: false, | ||
keys: false, | ||
name: 'easter-egg', | ||
pattern: false, | ||
target: 'html', | ||
withBus: true, | ||
}, | ||
plugin: { | ||
delay: 500, | ||
keys: ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a'], | ||
mouseEvents: [ | ||
'click', // Works with multiple single clicks pattern | ||
'dblclick', // Only works with single double click pattern set | ||
'mouseup', // Works with multiple mouseup clicks pattern | ||
'mousedown', // Works with multiple mousedown clicks pattern | ||
], | ||
pattern: [38, 38, 40, 40, 37, 39, 37, 39, 66, 65], | ||
type: 'keydown', | ||
}, | ||
defaultEggOptions: { | ||
callback: null, | ||
destroyBus: false, | ||
keys: false, | ||
name: 'easter-egg', | ||
pattern: false, | ||
target: 'html', | ||
withBus: true, | ||
}, | ||
@@ -44,6 +30,6 @@ eggOptions: {}, | ||
// Initiate Eggs // | ||
init(vue, pluginOptions, eggOptions = {}) { | ||
init(pluginOptions = {}, eggOptions = {}) { | ||
// Set Options // | ||
this.pluginOptions = { ...this.defaultOptions.plugin, ...pluginOptions }; | ||
this.eggOptions = { ...this.defaultOptions.egg, ...eggOptions }; | ||
this.pluginOptions = pluginOptions; | ||
this.eggOptions = { ...this.defaultEggOptions, ...eggOptions }; | ||
@@ -66,4 +52,4 @@ this.layEggs(); | ||
if (!newEgg.keys && !newEgg.pattern) { | ||
newEgg.keys = this.defaultOptions.plugin.keys; | ||
newEgg.pattern = this.defaultOptions.plugin.pattern; | ||
newEgg.keys = this.pluginOptions.keys; | ||
newEgg.pattern = this.pluginOptions.pattern; | ||
} | ||
@@ -99,3 +85,3 @@ }); | ||
// -------------------- Mouse Events // | ||
if (_.includes(EasterEggTrigger.defaultOptions.plugin.mouseEvents, e.type)) { | ||
if (_.includes(EasterEggTrigger.pluginOptions.mouseEvents, e.type)) { | ||
key = e.type; | ||
@@ -102,0 +88,0 @@ |
339213
4085