Skip to content

Commit ee981b4

Browse files
Cleaning up
1 parent 34fcf45 commit ee981b4

File tree

3 files changed

+10
-38
lines changed

3 files changed

+10
-38
lines changed

src/components/EasterEgg.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<div class="title">Click screen to close</div>
88
<div class="unicorn-container">
99
<svg
10-
class="unicorn"
1110
id="Layer_1"
12-
xmlns="http://www.w3.org/2000/svg"
11+
class="unicorn"
1312
viewBox="0 0 406.88 226.98"
13+
xmlns="http://www.w3.org/2000/svg"
1414
>
1515
<defs></defs>
1616
<g>
@@ -1024,13 +1024,9 @@ export default {
10241024
this.containerClass = '';
10251025
10261026
setTimeout(() => {
1027-
console.log('closeEasterEgg');
10281027
this.$emit('closeEasterEgg');
10291028
}, 1000);
10301029
},
1031-
consoleInfo(text) {
1032-
console.info(`%c${text}`, 'background: #000; color: #0f0; font-weight: bold; padding: 10px;');
1033-
},
10341030
},
10351031
};
10361032
</script>

src/index.js

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import EasterEggComponent from './components/EasterEggComponent.vue';
22
import EasterEggTriggerCore from './plugin/index';
33

4-
console.group('index.js');
5-
console.log({ EasterEggTriggerCore });
6-
7-
let globalOptions = {};
4+
const globalOptions = {
5+
delay: 500,
6+
};
87

98
const EasterEggTrigger = {
109
install(Vue, options = {}) {
@@ -13,37 +12,18 @@ const EasterEggTrigger = {
1312
}
1413

1514
// Set the Global options //
16-
globalOptions = options;
15+
globalOptions.delay = options.delay || globalOptions.delay;
1716

17+
// Add Component //
1818
Vue.component(EasterEggComponent.name, EasterEggComponent);
1919

20-
// 1. Add global method or property
21-
Vue.globalEasterEggMethod = function() {
22-
// some logic ...
23-
};
24-
25-
// 2. Add a global asset
26-
Vue.directive('easter-egg-trigger-directive', {
27-
bind(el, binding, vnode, oldVnode) {
28-
// some logic ...
29-
},
30-
});
31-
32-
// 3. Inject some component options
33-
Vue.mixin({
34-
created() {
35-
// some logic ...
36-
},
37-
});
38-
39-
// 4. add an instance method
20+
// Add Instance Methods //
4021
Vue.prototype.$easterEgg = function(methodOptions) {
41-
console.log('$easterEgg instance method loaded');
42-
EasterEggTriggerCore.init(globalOptions, methodOptions);
22+
EasterEggTriggerCore.init(Vue, globalOptions, methodOptions);
4323
};
4424

4525
Vue.prototype.$easterEggTrigger = function(methodOptions) {
46-
EasterEggTriggerCore.init(globalOptions, methodOptions);
26+
EasterEggTriggerCore.init(Vue, globalOptions, methodOptions);
4727
};
4828
},
4929
};
@@ -54,5 +34,3 @@ if (typeof window !== 'undefined' && window.Vue) {
5434
}
5535

5636
export default EasterEggTrigger;
57-
58-
console.groupEnd('index.js');

src/plugin/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
import EasterEggTriggerCore from './EasterEggTriggerCore';
22

3-
console.log('plugin index loaded', { EasterEggTriggerCore });
4-
53
export default EasterEggTriggerCore;

0 commit comments

Comments
 (0)