-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CodeSandbox): add CodeSandbox bot (#17)
* feat(CodeSandbox): Add CodeSandbox bot config * fix(CodeSandbox): fix paths to CodeSandbox sandboxes * fix(CodeSandbox): fix Jest tests * fix(CodeSandbox): CodeSandbox sandobex cleanup
- Loading branch information
Showing
20 changed files
with
51,919 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"sandboxes": ["/.codesandbox/sandbox/mixin", "/.codesandbox/sandbox/plugin"] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "vue-pwa-install-mixin-sandbox", | ||
"version": "0.1.0", | ||
"description": "Vue.js example project with the PWA Install mixin", | ||
"private": true, | ||
"scripts": { | ||
"serve": "vue-cli-service serve", | ||
"build": "vue-cli-service build", | ||
"lint": "vue-cli-service lint" | ||
}, | ||
"dependencies": { | ||
"@vue/cli-plugin-babel": "4.1.1", | ||
"vue": "^2.6.11", | ||
"vue-pwa-install": "../../../" | ||
}, | ||
"devDependencies": { | ||
"@vue/cli-service": "4.1.1", | ||
"vue-template-compiler": "^2.6.11" | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||
<title>codesandbox</title> | ||
</head> | ||
<body> | ||
<noscript> | ||
<strong>We're sorry but codesandbox doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> | ||
</noscript> | ||
<div id="app"></div> | ||
<!-- built files will be auto injected --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<div id="app"> | ||
<h1>Vue PWA Install – mixin</h1> | ||
|
||
<button v-if="deferredPrompt" @onClick="promptInstall"> | ||
Add to home screen | ||
</button> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { VuePwaInstallMixin } from "vue-pwa-install"; | ||
export default { | ||
name: "App", | ||
mixins: [VuePwaInstallMixin], | ||
data() { | ||
return { | ||
deferredPrompt: null, | ||
}; | ||
}, | ||
methods: { | ||
promptInstall() { | ||
// Show the prompt: | ||
this.deferredPrompt.prompt(); | ||
// Wait for the user to respond to the prompt: | ||
this.deferredPrompt.userChoice.then((choiceResult) => { | ||
if (choiceResult.outcome === "accepted") { | ||
console.log("User accepted the install prompt"); | ||
} else { | ||
console.log("User dismissed the install prompt"); | ||
} | ||
this.deferredPrompt = null; | ||
}); | ||
}, | ||
}, | ||
created() { | ||
this.$on("canInstall", (event) => { | ||
// Prevent Chrome 67 and earlier from automatically showing the prompt: | ||
event.preventDefault(); | ||
// Stash the event so it can be triggered later: | ||
this.deferredPrompt = event; | ||
}); | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Vue from "vue"; | ||
import App from "./App.vue"; | ||
|
||
Vue.config.productionTip = false; | ||
|
||
new Vue({ | ||
render: h => h(App) | ||
}).$mount("#app"); |
Oops, something went wrong.