Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example: update CDN example #3803

Merged
merged 3 commits into from Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 36 additions & 12 deletions examples/cdn-example/index.html
Expand Up @@ -2,22 +2,46 @@
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://releases.transloadit.com/uppy/v3.0.0-beta.1/uppy.min.css" rel="stylesheet">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://releases.transloadit.com/uppy/v3.0.0-beta.1/uppy.min.css" rel="stylesheet" />
</head>
<body>
<noscript>You need JavaScript enabled for this example to work.</noscript>
<button id="uppyModalOpener">Open Modal</button>
<script src="https://releases.transloadit.com/uppy/v3.0.0-beta.1/uppy.min.js"></script>
<script>
const uppy = new Uppy.Core({debug: true, autoProceed: false})
.use(Uppy.Dashboard, { trigger: '#uppyModalOpener' })
.use(Uppy.Webcam, {target: Uppy.Dashboard})
.use(Uppy.Tus, { endpoint: 'https://tusd.tusdemo.net/files/' })

uppy.on('success', (fileCount) => {
console.log(`${fileCount} files uploaded`)
})
<script type="module">
import {
Core,
Dashboard,
Webcam,
Tus,
} from "https://releases.transloadit.com/uppy/v3.0.0-beta.1/uppy.min.mjs";

const uppy = new Core.Uppy({ debug: true, autoProceed: false })
.use(Dashboard, { trigger: "#uppyModalOpener" })
.use(Webcam, { target: Dashboard })
.use(Tus, { endpoint: "https://tusd.tusdemo.net/files/" });

uppy.on("success", (fileCount) => {
console.log(`${fileCount} files uploaded`);
});
</script>

<!-- To support older browsers, you can use the legacy bundle which adds a global `Uppy` object. -->
<script nomodule src="https://releases.transloadit.com/uppy/v3.0.0-beta.1/uppy.legacy.min.js"></script>
<script nomodule>
{
const { Core, Dashboard, Webcam, Tus } = Uppy;
const uppy = new Core.Uppy({ debug: true, autoProceed: false })
.use(Dashboard, { trigger: "#uppyModalOpener" })
.use(Webcam, { target: Dashboard })
.use(Tus, { endpoint: "https://tusd.tusdemo.net/files/" });

uppy.on("success", function (fileCount) {
console.log(`${fileCount} files uploaded`);
});
}
</script>
</body>
</html>
7 changes: 5 additions & 2 deletions examples/cdn-example/package.json
@@ -1,5 +1,8 @@
{
"name": "@uppy-example/cdn-example",
"name": "@uppy-example/cdn",
"version": "0.0.0",
"private": true
"private": true,
"scripts": {
"dev": "deno run --allow-net --allow-read https://deno.land/std/http/file_server.ts"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deno, was this for testing? As I don’t think we require the deno binary to run the examples.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for testing. Technically we don’t need a web server at all, we could open the html file directly.

}
}
4 changes: 2 additions & 2 deletions yarn.lock
Expand Up @@ -9749,9 +9749,9 @@ __metadata:
languageName: unknown
linkType: soft

"@uppy-example/cdn-example@workspace:examples/cdn-example":
"@uppy-example/cdn@workspace:examples/cdn-example":
version: 0.0.0-use.local
resolution: "@uppy-example/cdn-example@workspace:examples/cdn-example"
resolution: "@uppy-example/cdn@workspace:examples/cdn-example"
languageName: unknown
linkType: soft

Expand Down