Skip to content

Commit

Permalink
chore: adding demo build configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodek committed Nov 25, 2019
1 parent ef3dfee commit a87e416
Show file tree
Hide file tree
Showing 7 changed files with 889 additions and 4 deletions.
18 changes: 18 additions & 0 deletions apic-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
@license
Copyright 2019 The Advanced REST client authors <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
*/
import './api-console.js';
import './api-console-app.js';
import '@advanced-rest-client/oauth-authorization/oauth1-authorization.js';
import '@advanced-rest-client/oauth-authorization/oauth2-authorization.js';
import '@advanced-rest-client/xhr-simple-request/xhr-simple-request.js';
44 changes: 44 additions & 0 deletions build-demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!doctype html>
<html lang="en">
<head></head>
<body>
<script src="dist/vendor.js"></script>
<script src="dist/apic-import.js"></script>

<api-navigation compatibility></api-navigation>
<api-documentation compatibility handlenavigationevents></api-documentation>
<api-request-panel compatibility handlenavigationevents></api-request-panel>
<xhr-simple-request></xhr-simple-request>

<script>
{
function loadImportScript() {
var is = document.createElement('script');
is.src = 'dist/apic-import.js';
document.body.appendChild(is);
}
if (navigator.userAgent.indexOf('Trident') !== -1) {
setTimeout(loadImportScript, 1);
} else {
loadImportScript();
}

var resource = 'demo/models/google-drive-api-compact.json';
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', function(e) {
var response = e.target.responseText;
var model = JSON.parse(response);
var nodes = document.querySelectorAll('api-request-panel,api-navigation,api-documentation');
for (var i = 0; i < nodes.length; i++) {
nodes[i].amf = model;
}
});
xhr.addEventListener('error', function(e) {
console.error('Request errored with status', e.target.status);
});
xhr.open('GET', resource);
xhr.send();
}
</script>
</body>
</html>
26 changes: 26 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<!-- ./components is a path in the final build -->
<!-- <script src="./node_modules/jsonlint/lib/jsonlint.js"></script>
<script src="./node_modules/codemirror/lib/codemirror.js"></script>
<script src="./node_modules/codemirror/addon/mode/loadmode.js"></script>
<script src="./node_modules/codemirror/mode/meta.js"></script>
<script src="./node_modules/codemirror/mode/javascript/javascript.js"></script>
<script src="./node_modules/codemirror/mode/xml/xml.js"></script>
<script src="./node_modules/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<script src="./node_modules/codemirror/addon/lint/lint.js"></script>
<script src="./node_modules/codemirror/addon/lint/json-lint.js"></script>
<script src="./node_modules/cryptojslib/core.js"></script>
<script src="./node_modules/cryptojslib/rollups/sha1.js"></script>
<script src="./node_modules/cryptojslib/enc-base64-min.js"></script>
<script src="./node_modules/cryptojslib/rollups/md5.js"></script>
<script src="./node_modules/cryptojslib/rollups/hmac-sha1.js"></script>
<script src="./node_modules/jsrsasign/lib/jsrsasign-rsa-min.js"></script> -->
<script src="./vendor.js"></script>
<script type="module" src="./apic-build.js"></script>
</head>
<body>
<api-console-app modellocation="../demo/models/google-drive-api-compact.json"></api-console-app>
</body>
</html>
Loading

0 comments on commit a87e416

Please sign in to comment.