forked from wkdonc/wkdonc.github.io
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
json schema load method and reorganize rules.js
- Loading branch information
1 parent
1c1de00
commit 5fca550
Showing
3 changed files
with
146 additions
and
183 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
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
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 |
---|---|---|
@@ -1,21 +1,10 @@ | ||
// word list | ||
// import words from './words.json' assert { type: 'json' }; | ||
let words; | ||
|
||
fetch('./words.json') | ||
.then(response => response.json()) | ||
.then(data => { | ||
// Check if the imported JSON object has the expected type property | ||
if (data && typeof data === 'object') { | ||
// Proceed with your code | ||
words = data; | ||
} else { | ||
console.error('The imported JSON file does not have the expected type property.'); | ||
} | ||
}) | ||
.catch(error => console.error('Error fetching JSON:', error)); | ||
|
||
var words; | ||
|
||
$.getJSON("./words.json", function(data) { | ||
words = data; | ||
}) | ||
|
||
|
||
export default words; |