StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
67 lines
1.8 KiB
4 years ago
|
# vue-plugin-load-script []()
|
||
|
A Vue plugin for injecting remote scripts.
|
||
|
|
||
|
## Install
|
||
|
|
||
|
``` bash
|
||
|
# npm
|
||
|
npm install --save-dev vue-plugin-load-script
|
||
|
```
|
||
|
|
||
|
``` bash
|
||
|
# yarn
|
||
|
yarn add --dev vue-plugin-load-script
|
||
|
```
|
||
|
|
||
|
## Use
|
||
|
|
||
|
```javascript
|
||
|
// In main.js
|
||
|
import LoadScript from 'vue-plugin-load-script';
|
||
|
|
||
|
Vue.use(LoadScript);
|
||
|
```
|
||
|
|
||
|
```javascript
|
||
|
// As a global method
|
||
|
Vue.loadScript("https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY")
|
||
|
.then(() => {
|
||
|
// Script is loaded, do something
|
||
|
})
|
||
|
.catch(() => {
|
||
|
// Failed to fetch script
|
||
|
});
|
||
|
|
||
|
// As an instance method inside a component
|
||
|
this.$loadScript("https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY")
|
||
|
.then(() => {
|
||
|
// Script is loaded, do something
|
||
|
})
|
||
|
.catch(() => {
|
||
|
// Failed to fetch script
|
||
|
});
|
||
|
```
|
||
|
|
||
|
:zap: __New in 1.2!__
|
||
|
If you'd like to remove (unload) the script at any point, then call the companion method `$unloadScript` __with the same URL__.
|
||
|
|
||
|
```javascript
|
||
|
// As a global method
|
||
|
Vue.unloadScript("https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY")
|
||
|
.then(() => {
|
||
|
// Script was unloaded successfully
|
||
|
})
|
||
|
.catch(() => {
|
||
|
// Script couldn't be found to unload; make sure it was loaded and that you passed the same URL
|
||
|
});
|
||
|
|
||
|
// As an instance method inside a component
|
||
|
this.$unloadScript("https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY")
|
||
|
.then(() => {
|
||
|
// Script was unloaded successfully
|
||
|
})
|
||
|
.catch(() => {
|
||
|
// Script couldn't be found to unload; make sure it was loaded and that you passed the same URL
|
||
|
});
|
||
|
```
|
||
|
In most situations, you can just call `Vue.unloadScript`/`this.$unloadScript` and ignore the returned promise.
|