playground files
This commit is contained in:
parent
9305ae2384
commit
6b8833e766
@ -44,8 +44,9 @@ export class ChromeBadge implements Badge {
|
|||||||
rotationAngle: number = 0;
|
rotationAngle: number = 0;
|
||||||
static rotationAngleMax = 1000;
|
static rotationAngleMax = 1000;
|
||||||
|
|
||||||
constructor() {
|
constructor(window?: Window) {
|
||||||
let bg = chrome.extension.getBackgroundPage();
|
// Allow injecting another window for testing
|
||||||
|
let bg = window || chrome.extension.getBackgroundPage();
|
||||||
this.canvas = bg.document.createElement("canvas");
|
this.canvas = bg.document.createElement("canvas");
|
||||||
this.canvas.width = 32;
|
this.canvas.width = 32;
|
||||||
this.canvas.height = 32;
|
this.canvas.height = 32;
|
||||||
@ -76,11 +77,14 @@ export class ChromeBadge implements Badge {
|
|||||||
this.talerLogo.height,
|
this.talerLogo.height,
|
||||||
0, 0, this.canvas.width, this.canvas.height);
|
0, 0, this.canvas.width, this.canvas.height);
|
||||||
|
|
||||||
let imageData = this.ctx.getImageData(0,
|
// Allow running outside the extension for testing
|
||||||
0,
|
if (chrome && chrome.browserAction) {
|
||||||
this.canvas.width,
|
let imageData = this.ctx.getImageData(0,
|
||||||
this.canvas.height);
|
0,
|
||||||
chrome.browserAction.setIcon({imageData});
|
this.canvas.width,
|
||||||
|
this.canvas.height);
|
||||||
|
chrome.browserAction.setIcon({imageData});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private animate() {
|
private animate() {
|
||||||
|
1
playground/README
Normal file
1
playground/README
Normal file
@ -0,0 +1 @@
|
|||||||
|
Contains files with small experiments / prototypes for designers.
|
34
playground/animation.html
Normal file
34
playground/animation.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Spinner playground</title>
|
||||||
|
<script src="../lib/vendor/system-csp-production.src.js"></script>
|
||||||
|
</head>
|
||||||
|
<html>
|
||||||
|
<div style="display: none;">
|
||||||
|
<img src="../img/icon.png" id="taler-logo" style="display:hidden;">
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div id="container"></div>
|
||||||
|
<script>
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
System.config({
|
||||||
|
defaultJSExtensions: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
System.import("../lib/wallet/chromeBadge")
|
||||||
|
.then((badge) => {
|
||||||
|
let b = new badge.ChromeBadge(window);
|
||||||
|
window.badge = b;
|
||||||
|
document.getElementById("container").appendChild(b.canvas);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.error(e.stack);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<br />
|
||||||
|
<button onclick="badge.startBusy()">start</button>
|
||||||
|
<button onclick="badge.stopBusy()">stop</button>
|
||||||
|
</html>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user