mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-17 13:56:01 +00:00
Modules
This commit is contained in:
43
node_modules/@firebase/installations/test-app/index.html
generated
vendored
Normal file
43
node_modules/@firebase/installations/test-app/index.html
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Test App</title>
|
||||
<script src="sdk.js"></script>
|
||||
<style>
|
||||
.formatted-content {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<label for="appName">App Name</label>
|
||||
<input id="appName" value="app-name" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="projectId">Project Id</label>
|
||||
<input id="projectId" value="android-gcm-test-519bd" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="apiKey">API Key</label>
|
||||
<input id="apiKey" value="AIzaSyB2bpGcqUx37Gm0iCUw0c7xj75arKYYcbA" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="appId">App ID</label>
|
||||
<input id="appId" value="1:35006771263:android:d93b5ca1475efe57" />
|
||||
</p>
|
||||
<p>
|
||||
<button id="getId">Get ID</button>
|
||||
<button id="getToken">Get Token</button>
|
||||
<button id="deleteInstallation">Delete Installation</button>
|
||||
<button id="clearDb">Clear IndexedDB</button>
|
||||
</p>
|
||||
<h1>Requests</h1>
|
||||
<div id="requests"></div>
|
||||
<h1>Database Contents</h1>
|
||||
<div id="database"></div>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
113
node_modules/@firebase/installations/test-app/index.js
generated
vendored
Normal file
113
node_modules/@firebase/installations/test-app/index.js
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
const DATABASE_NAME = 'firebase-installations-database';
|
||||
const DATABASE_VERSION = 1;
|
||||
const OBJECT_STORE_NAME = 'firebase-installations-store';
|
||||
|
||||
const requestLogs = [];
|
||||
let db;
|
||||
|
||||
window.indexedDB.open(DATABASE_NAME, DATABASE_VERSION).onsuccess = event => {
|
||||
db = event.target.result;
|
||||
setInterval(refreshDatabase, 1000);
|
||||
};
|
||||
|
||||
function refreshDatabase() {
|
||||
const request = db
|
||||
.transaction(OBJECT_STORE_NAME, 'readwrite')
|
||||
.objectStore(OBJECT_STORE_NAME)
|
||||
.getAll();
|
||||
|
||||
request.onsuccess = () => {
|
||||
const dbElement = getElement('database');
|
||||
dbElement.innerHTML = request.result
|
||||
.map(v => `<p>${format(v)}</p>`)
|
||||
.join('');
|
||||
};
|
||||
}
|
||||
|
||||
function clearDb() {
|
||||
const request = db
|
||||
.transaction(OBJECT_STORE_NAME, 'readwrite')
|
||||
.objectStore(OBJECT_STORE_NAME)
|
||||
.clear();
|
||||
request.onsuccess = refreshDatabase;
|
||||
}
|
||||
|
||||
function getElement(id) {
|
||||
const element = document.getElementById(id);
|
||||
if (!element) {
|
||||
throw new Error(`Element not found: ${id}`);
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
function getInputValue(elementId) {
|
||||
const element = getElement(elementId);
|
||||
return element.value;
|
||||
}
|
||||
|
||||
function getId() {
|
||||
printRequest('Get ID', FirebaseInstallations.getId(getApp()));
|
||||
}
|
||||
|
||||
function getToken() {
|
||||
printRequest('Get Token', FirebaseInstallations.getToken(getApp()));
|
||||
}
|
||||
|
||||
function deleteInstallation() {
|
||||
printRequest(
|
||||
'Delete Installation',
|
||||
FirebaseInstallations.deleteInstallation(getApp())
|
||||
);
|
||||
}
|
||||
|
||||
async function printRequest(requestInfo, promise) {
|
||||
const requestsElement = getElement('requests');
|
||||
requestsElement.innerHTML = '<p><b>Loading...</b></p>' + requestLogs.join('');
|
||||
let result;
|
||||
try {
|
||||
const request = await promise;
|
||||
result = request ? format(request) : 'Completed successfully';
|
||||
} catch (e) {
|
||||
result = e.toString();
|
||||
}
|
||||
requestLogs.unshift(`<p><b>${requestInfo}:</b><br>${result}</p>`);
|
||||
requestsElement.innerHTML = requestLogs.join('');
|
||||
}
|
||||
|
||||
function format(o) {
|
||||
const escapedString = JSON.stringify(o, null, 2);
|
||||
return `<span class="formatted-content">${escapedString}</span>`;
|
||||
}
|
||||
|
||||
function getApp() {
|
||||
const appName = getInputValue('appName');
|
||||
const projectId = getInputValue('projectId');
|
||||
const apiKey = getInputValue('apiKey');
|
||||
const appId = getInputValue('appId');
|
||||
return {
|
||||
name: appName,
|
||||
options: { projectId, apiKey, appId }
|
||||
};
|
||||
}
|
||||
|
||||
getElement('getId').onclick = getId;
|
||||
getElement('getToken').onclick = getToken;
|
||||
getElement('deleteInstallation').onclick = deleteInstallation;
|
||||
getElement('clearDb').onclick = clearDb;
|
48
node_modules/@firebase/installations/test-app/rollup.config.js
generated
vendored
Normal file
48
node_modules/@firebase/installations/test-app/rollup.config.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* 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 typescriptPlugin from 'rollup-plugin-typescript2';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import json from 'rollup-plugin-json';
|
||||
import { uglify } from 'rollup-plugin-uglify';
|
||||
import typescript from 'typescript';
|
||||
|
||||
/**
|
||||
* Creates an iife build to run with the Test App.
|
||||
*/
|
||||
export default [
|
||||
{
|
||||
input: 'src/functions/index.ts',
|
||||
output: {
|
||||
name: 'FirebaseInstallations',
|
||||
file: 'test-app/sdk.js',
|
||||
format: 'iife',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [
|
||||
typescriptPlugin({
|
||||
typescript,
|
||||
tsconfigOverride: { compilerOptions: { declaration: false } }
|
||||
}),
|
||||
json(),
|
||||
resolve(),
|
||||
commonjs(),
|
||||
uglify()
|
||||
]
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user