Skip to content
This repository was archived by the owner on Aug 3, 2019. It is now read-only.

Commit a6130ad

Browse files
fix: change exported variable name to OverlayScrollbarsVue to fix its conflict with main library
fix: import OverlayScrollbars change inner instance of OverlayScrollbars name to instance
1 parent 2d5200c commit a6130ad

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ You can also provide options
4343
</overlay-scrollbars>
4444
```
4545

46+
To access OverlayScrollbars instance and for example add extensions to it see this [example](https://codepen.io/H4M3D3/pen/qJYjWq)
47+
4648
If you have discovered a 🐜 or have a feature suggestion, feel free to create an [issue](https://github.com/parsisolution/os-vue/issues) on Github.
4749

4850
# License

rollup.config.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Released under the <%= pkg.license %> License.`,
3838
]
3939
}
4040

41+
let external = ['overlayscrollbars/js/OverlayScrollbars'];
42+
4143
let plugins = defaultPlugins();
4244
plugins.splice(2, 1);
4345

@@ -48,27 +50,28 @@ productionESPlugins[2] = uglifyES();
4850
let configs = [
4951
{
5052
input: path.resolve(src, 'plugin.common.js'),
51-
// external: Object.keys(dependencies),
53+
external,
5254
plugins,
5355
output: [
5456
{
5557
format: 'cjs',
5658
exports: 'named',
57-
name: 'OverlayScrollbars',
59+
name: 'OverlayScrollbarsVue',
5860
file: path.resolve(dist, name + '.common.js'),
5961
sourcemap: true
6062
},
6163
{
6264
format: 'umd',
6365
exports: 'named',
64-
name: 'OverlayScrollbars',
66+
name: 'OverlayScrollbarsVue',
6567
file: path.resolve(dist, name + '.js'),
6668
sourcemap: true
6769
}
6870
],
6971
},
7072
{
7173
input: path.resolve(src, 'plugin.js'),
74+
external,
7275
plugins,
7376
output: {
7477
format: 'es',
@@ -78,10 +81,11 @@ let configs = [
7881
},
7982
{
8083
input: path.resolve(src, 'OverlayScrollbars.js'),
84+
external,
8185
plugins,
8286
output: {
8387
format: 'umd',
84-
name: 'OverlayScrollbars',
88+
name: 'OverlayScrollbarsVue',
8589
file: path.resolve(base, 'overlay-scrollbars.js'),
8690
// sourcemap: true
8791
},
@@ -92,28 +96,31 @@ if (process.env.NODE_ENV === 'production') {
9296
let newConfigs = [
9397
{
9498
input: path.resolve(src, 'plugin.common.js'),
99+
external,
95100
plugins: productionPlugins,
96101
output: {
97102
format: 'cjs',
98103
exports: 'named',
99-
name: 'OverlayScrollbars',
104+
name: 'OverlayScrollbarsVue',
100105
file: path.resolve(dist, name + '.common.min.js'),
101106
sourcemap: true
102107
},
103108
},
104109
{
105110
input: path.resolve(src, 'plugin.common.js'),
111+
external,
106112
plugins: productionPlugins,
107113
output: {
108114
format: 'umd',
109115
exports: 'named',
110-
name: 'OverlayScrollbars',
116+
name: 'OverlayScrollbarsVue',
111117
file: path.resolve(dist, name + '.min.js'),
112118
sourcemap: true
113119
},
114120
},
115121
{
116122
input: path.resolve(src, 'plugin.js'),
123+
external,
117124
plugins: productionESPlugins,
118125
output: {
119126
format: 'es',
@@ -123,10 +130,11 @@ if (process.env.NODE_ENV === 'production') {
123130
},
124131
{
125132
input: path.resolve(src, 'OverlayScrollbars.js'),
133+
external,
126134
plugins: productionPlugins,
127135
output: {
128136
format: 'umd',
129-
name: 'OverlayScrollbars',
137+
name: 'OverlayScrollbarsVue',
130138
file: path.resolve(base, 'overlay-scrollbars.js'),
131139
// sourcemap: true
132140
},

src/OverlayScrollbars.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import 'overlayscrollbars/js/OverlayScrollbars';
2+
13
export default {
24
name: "overlay-scrollbars",
35

46
data() {
57
return {
6-
oscroll: null,
8+
instance: null,
79
}
810
},
911

@@ -15,13 +17,13 @@ export default {
1517
},
1618

1719
mounted() {
18-
if (!this.oscroll)
19-
this.oscroll = OverlayScrollbars(this.$el, this.options);
20+
if (!this.instance)
21+
this.instance = OverlayScrollbars(this.$el, this.options);
2022
},
2123

2224
beforeDestroy() {
23-
this.oscroll.destroy();
24-
this.oscroll = null;
25+
this.instance.destroy();
26+
this.instance = null;
2527
},
2628

2729
render(h) {

0 commit comments

Comments
 (0)