Skip to content

Commit c508280

Browse files
author
Ryan A. Johnson
committed
docs(refactor): remove jquery
- replace `$.ajax()` with `fetch()`
1 parent 9ce67fd commit c508280

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

docs/_templates/partials/after_footer.njk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
<script src="https://unpkg.com/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
1313
</span>
1414

15-
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
16-
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
17-
crossorigin="anonymous"></script>
18-
1915
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
2016
<script src="dist/scripts/helix-ui.browser.js"></script>
2117
<script src="docs.js"></script>

docs/components/icons/icon-demo.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
if (document.getElementById('vue-iconDemo')) {
22
const Icons = {
3-
fetchAll: function () {
4-
return $.ajax({
5-
async: false,
6-
dataType: 'json',
7-
url: 'data/icons.json',
8-
});
3+
fetch: function () {
4+
return fetch('data/icons.json');
5+
},
6+
fetchJSON: function () {
7+
return this.fetch().then(res => res.json());
98
},
109
};//Icons
1110

@@ -16,9 +15,8 @@ if (document.getElementById('vue-iconDemo')) {
1615
filter: '',
1716
},
1817
beforeMount: function () {
19-
Icons.fetchAll().then((data) => {
20-
this.icons = data;
21-
});
18+
Icons.fetchJSON()
19+
.then(json => this.icons = json);
2220
},
2321
methods: {
2422
onFilterUpdate: function (evt) {

docs/docs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
import 'whatwg-fetch';
23

34
import './components/accordions/accordion-demo';
45
import './components/alerts/alert-demo';

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
"svg-inline-loader": "^0.8.0",
5252
"tar": "^4.4.4",
5353
"uglify-es": "^3.2.2",
54-
"webpack": "4.x"
54+
"webpack": "4.x",
55+
"whatwg-fetch": "^2.0.4"
5556
},
5657
"scripts": {
5758
"apidocs": "jsdoc -c jsdoc.conf.json",

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5117,6 +5117,10 @@ [email protected]:
51175117
watchpack "^1.5.0"
51185118
webpack-sources "^1.0.1"
51195119

5120+
whatwg-fetch@^2.0.4:
5121+
version "2.0.4"
5122+
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"
5123+
51205124
which-module@^1.0.0:
51215125
version "1.0.0"
51225126
resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f"

0 commit comments

Comments
 (0)