Skip to content

Commit 1e69f99

Browse files
wip(docs): enhancements
1 parent e33ca30 commit 1e69f99

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

docs/examples.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,27 @@ npm install express # or yarn add express
2828
node -e "require('express')().use(require('express').static(__dirname, {index:'index.html'})).listen(8181)"
2929
```
3030

31+
**note:**
32+
In the following examples, for convenience, we just returns static content as file. In real world, you would probably use something like this :
33+
```javascript
34+
...
35+
async getFile(url) {
36+
37+
const res = await fetch(url);
38+
39+
if ( !res.ok ) {
40+
41+
throw Object.assign(new Error(res.statusText + ' ' + url), { res });
42+
}
43+
44+
return {
45+
getContentData: (asBinary) => asBinary ? res.arrayBuffer() : res.text(),
46+
}
47+
48+
},
49+
...
50+
```
51+
3152

3253
## Vue2 basic example
3354

@@ -912,6 +933,8 @@ This example use Vue2 because **vue-calendar-picker** is written for Vue2.
912933
},
913934
getFile: async (url) => {
914935
936+
// note: here, for convinience, we just returns a content from a
937+
915938
if ( new URL(url).pathname === '/main.vue' ) {
916939
917940
return {

docs/faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const options = {
2525
then, subsequent `import Vue from 'vue'` will return the Vue module (`options.moduleCache.vue`).
2626

2727
#### From the same origin
28-
If your plugin is reachable from the current URL (same origin, relative or absolute) just use `import from`, `import()` or `require()`.
29-
`vue3-sfc-loader` is able to load esm and cjs modules). Just take care to specify the plugin entry point.
28+
If your plugin is reachable from the current URL (same origin, relative or absolute) just use `import ... from`, `import()` or `require()`.
29+
`vue3-sfc-loader` is able to load esm, cjs and umd modules). Just take care to specify the full entry point of the plugin.
3030

3131

3232
eg.

0 commit comments

Comments
 (0)