Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
3bc5e1d0e2 | |||
96a88112dc | |||
6c0c1e165f | |||
653a4138a9 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@designestate/dees-domtools",
|
"name": "@designestate/dees-domtools",
|
||||||
"version": "2.0.15",
|
"version": "2.0.17",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@designestate/dees-domtools",
|
"name": "@designestate/dees-domtools",
|
||||||
"version": "2.0.15",
|
"version": "2.0.17",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apiglobal/typedrequest": "^2.0.3",
|
"@apiglobal/typedrequest": "^2.0.3",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@designestate/dees-domtools",
|
"name": "@designestate/dees-domtools",
|
||||||
"version": "2.0.15",
|
"version": "2.0.17",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "tools to simplify complex css structures",
|
"description": "tools to simplify complex css structures",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -146,6 +146,21 @@ export class DomTools {
|
|||||||
this.elements.headElement.appendChild(styleElement);
|
this.elements.headElement.appendChild(styleElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* allows to set global styles
|
||||||
|
* @param stylesText the css text you want to set
|
||||||
|
*/
|
||||||
|
public async setExternalScript(scriptLinkArg: string) {
|
||||||
|
await this.domReady.promise;
|
||||||
|
const done = plugins.smartpromise.defer();
|
||||||
|
const script = document.createElement('script')
|
||||||
|
script.src = scriptLinkArg;
|
||||||
|
script.addEventListener('load', function() {
|
||||||
|
done.resolve();
|
||||||
|
});
|
||||||
|
await done.promise;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* allows setting external css files
|
* allows setting external css files
|
||||||
* @param cssLinkArg a url to an external stylesheet
|
* @param cssLinkArg a url to an external stylesheet
|
||||||
|
@ -128,8 +128,6 @@ export enum Key {
|
|||||||
Quote = 222,
|
Quote = 222,
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeyCombo = Array<Key>;
|
|
||||||
|
|
||||||
export class Keyboard {
|
export class Keyboard {
|
||||||
private mapCombosToHandlers = new Map<number[], plugins.smartrx.rxjs.Subject<KeyboardEvent>>();
|
private mapCombosToHandlers = new Map<number[], plugins.smartrx.rxjs.Subject<KeyboardEvent>>();
|
||||||
private pressedKeys = new Set<Key>();
|
private pressedKeys = new Set<Key>();
|
||||||
@ -176,10 +174,10 @@ export class Keyboard {
|
|||||||
this.pressedKeys.delete(event.keyCode);
|
this.pressedKeys.delete(event.keyCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
private areAllKeysPressed(combo: number[]) {
|
private areAllKeysPressed(keysArg: Key[]) {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
combo.forEach((key) => {
|
keysArg.forEach((key) => {
|
||||||
if (!this.pressedKeys.has(key)) {
|
if (!this.pressedKeys.has(key)) {
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user