回答編集履歴
1
sample
test
CHANGED
@@ -3,3 +3,57 @@
|
|
3
3
|
file1.js が変なスコープを利用せずグローバルに書いているなら
|
4
4
|
|
5
5
|
そのままいけるでしょう
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
//hoge.html
|
10
|
+
|
11
|
+
```
|
12
|
+
|
13
|
+
<script src="file1.js"></script>
|
14
|
+
|
15
|
+
<script src="file2.js"></script>
|
16
|
+
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
//hoge.txt
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
test
|
26
|
+
|
27
|
+
```
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
//file1.js
|
32
|
+
|
33
|
+
```
|
34
|
+
|
35
|
+
const url='hoge.txt';//本来であれば何らかのapi
|
36
|
+
|
37
|
+
let Dialogflow=fetch(url).then(res=>res.text());
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
//file2.js
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
(async()=>{
|
48
|
+
|
49
|
+
const diary = {
|
50
|
+
|
51
|
+
bbb: await Dialogflow
|
52
|
+
|
53
|
+
};
|
54
|
+
|
55
|
+
console.log(diary);
|
56
|
+
|
57
|
+
})();
|
58
|
+
|
59
|
+
```
|