Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

skynet-mysky-utils

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skynet-mysky-utils - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

6

CHANGELOG.md
# Changelog
## [0.1.2]
### Changed
- Fix createFullScreenIframe and monitorWindowError
## [0.1.1]

@@ -4,0 +10,0 @@

4

dist/index.d.ts

@@ -5,5 +5,5 @@ export { Permission, PermCategory, PermType, PermDiscoverable, PermHidden, PermLegacySkyID, PermRead, PermWrite } from "./permissions";

export { createFullScreenIframe, createIframe, ensureUrl } from "./utils";
export { errorWindowClosed, ErrorHolder, monitorWindowError } from "./window-listener";
export { dispatchedErrorEvent, errorWindowClosed, monitorWindowError } from "./window-listener";
import { Permission } from "./permissions";
export declare const defaultHandshakeMaxAttempts = 100;
export declare const defaultHandshakeMaxAttempts = 150;
export declare const defaultHandshakeAttemptsInterval = 100;

@@ -10,0 +10,0 @@ export declare type CheckPermissionsResponse = {

@@ -10,3 +10,3 @@ "use strict";

exports.__esModule = true;
exports.defaultHandshakeAttemptsInterval = exports.defaultHandshakeMaxAttempts = exports.monitorWindowError = exports.ErrorHolder = exports.errorWindowClosed = exports.ensureUrl = exports.createIframe = exports.createFullScreenIframe = exports.PromiseController = exports.monitorOtherListener = exports.listenForStorageEvent = exports.emitStorageEvent = exports.defaultWindowTimeout = exports.PermWrite = exports.PermRead = exports.PermLegacySkyID = exports.PermHidden = exports.PermDiscoverable = exports.PermType = exports.PermCategory = exports.Permission = void 0;
exports.defaultHandshakeAttemptsInterval = exports.defaultHandshakeMaxAttempts = exports.monitorWindowError = exports.errorWindowClosed = exports.dispatchedErrorEvent = exports.ensureUrl = exports.createIframe = exports.createFullScreenIframe = exports.PromiseController = exports.monitorOtherListener = exports.listenForStorageEvent = exports.emitStorageEvent = exports.defaultWindowTimeout = exports.PermWrite = exports.PermRead = exports.PermLegacySkyID = exports.PermHidden = exports.PermDiscoverable = exports.PermType = exports.PermCategory = exports.Permission = void 0;
var permissions_1 = require("./permissions");

@@ -33,7 +33,7 @@ __createBinding(exports, permissions_1, "Permission");

var window_listener_1 = require("./window-listener");
__createBinding(exports, window_listener_1, "dispatchedErrorEvent");
__createBinding(exports, window_listener_1, "errorWindowClosed");
__createBinding(exports, window_listener_1, "ErrorHolder");
__createBinding(exports, window_listener_1, "monitorWindowError");
exports.defaultHandshakeMaxAttempts = 100;
exports.defaultHandshakeMaxAttempts = 150;
exports.defaultHandshakeAttemptsInterval = 100;
//# sourceMappingURL=index.js.map

@@ -29,3 +29,15 @@ "use strict";

childFrame.name = name;
childFrame.style.content = "position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;";
// Set properties to make the iframe full-screen.
childFrame.style.position = "fixed";
childFrame.style.top = "0";
childFrame.style.left = "0";
childFrame.style.bottom = "0";
childFrame.style.right = "0";
childFrame.style.width = "100%";
childFrame.style.height = "100%";
childFrame.style.border = "none";
childFrame.style.margin = "0";
childFrame.style.padding = "0";
childFrame.style.overflow = "hidden";
childFrame.style.zIndex = "999999";
// Set sandbox permissions.

@@ -32,0 +44,0 @@ // TODO: Enable sandboxing?

import { PromiseController } from "./storage_listener";
export declare const errorWindowClosed = "window-closed";
export declare class ErrorHolder {
error: string;
}
export declare const dispatchedErrorEvent = "catchError";
/**
* Checks if there has been an error from the window on an interval.
*/
export declare function monitorWindowError(errorHolder: ErrorHolder): {
export declare function monitorWindowError(): {
promise: Promise<void>;

@@ -11,0 +9,0 @@ controller: PromiseController;

"use strict";
exports.__esModule = true;
exports.monitorWindowError = exports.ErrorHolder = exports.errorWindowClosed = void 0;
exports.monitorWindowError = exports.dispatchedErrorEvent = exports.errorWindowClosed = void 0;
var storage_listener_1 = require("./storage_listener");
exports.errorWindowClosed = "window-closed";
var ErrorHolder = /** @class */ (function () {
function ErrorHolder() {
this.error = "";
}
return ErrorHolder;
}());
exports.ErrorHolder = ErrorHolder;
exports.dispatchedErrorEvent = "catchError";
/**
* Checks if there has been an error from the window on an interval.
*/
function monitorWindowError(errorHolder) {
var pingInterval = 100;
function monitorWindowError() {
var controller = new storage_listener_1.PromiseController();
var abortController = new AbortController();
var promise = new Promise(function (resolve, reject) {
var pingFunc = function () {
if (errorHolder.error !== "") {
reject(errorHolder.error);
}
var handleEvent = function (e) {
window.removeEventListener(exports.dispatchedErrorEvent, handleEvent);
var err = e.detail;
reject(err);
};
var intervalId = window.setInterval(pingFunc, pingInterval);
// @ts-expect-error doesn't recognize signal option.
window.addEventListener(exports.dispatchedErrorEvent, handleEvent, {
signal: abortController.signal
});
// Initialize cleanup function.
controller.cleanup = function () {
// Clear the interval.
window.clearInterval(intervalId);
// Abort the event listener.
abortController.abort();
// Cleanup the promise.

@@ -31,0 +28,0 @@ resolve();

{
"name": "skynet-mysky-utils",
"version": "0.1.1",
"version": "0.1.2",
"description": "Skynet common MySky utilities",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -25,7 +25,7 @@ export {

export { createFullScreenIframe, createIframe, ensureUrl } from "./utils";
export { errorWindowClosed, ErrorHolder, monitorWindowError } from "./window-listener";
export { dispatchedErrorEvent, errorWindowClosed, monitorWindowError } from "./window-listener";
import { Permission } from "./permissions";
export const defaultHandshakeMaxAttempts = 100;
export const defaultHandshakeMaxAttempts = 150;
export const defaultHandshakeAttemptsInterval = 100;

@@ -32,0 +32,0 @@

@@ -30,4 +30,17 @@ /**

childFrame.name = name;
childFrame.style.content = "position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;";
// Set properties to make the iframe full-screen.
childFrame.style.position = "fixed";
childFrame.style.top = "0";
childFrame.style.left = "0";
childFrame.style.bottom = "0";
childFrame.style.right = "0";
childFrame.style.width = "100%";
childFrame.style.height = "100%";
childFrame.style.border = "none";
childFrame.style.margin = "0";
childFrame.style.padding = "0";
childFrame.style.overflow = "hidden";
childFrame.style.zIndex = "999999";
// Set sandbox permissions.

@@ -34,0 +47,0 @@ // TODO: Enable sandboxing?

import { PromiseController } from "./storage_listener";
export const errorWindowClosed = "window-closed";
export const dispatchedErrorEvent = "catchError";
export class ErrorHolder {
error = "";
}
/**
* Checks if there has been an error from the window on an interval.
*/
export function monitorWindowError(errorHolder: ErrorHolder): { promise: Promise<void>; controller: PromiseController } {
const pingInterval = 100;
export function monitorWindowError(): { promise: Promise<void>; controller: PromiseController } {
const controller = new PromiseController();
const abortController = new AbortController();
const promise: Promise<void> = new Promise((resolve, reject) => {
const pingFunc = () => {
if (errorHolder.error !== "") {
reject(errorHolder.error);
}
const handleEvent = function (e: any) {
window.removeEventListener(dispatchedErrorEvent, handleEvent);
const err = e.detail;
reject(err);
};
// @ts-expect-error doesn't recognize signal option.
window.addEventListener(dispatchedErrorEvent, handleEvent, {
signal: abortController.signal,
});
const intervalId = window.setInterval(pingFunc, pingInterval);
// Initialize cleanup function.
controller.cleanup = () => {
// Clear the interval.
window.clearInterval(intervalId);
// Abort the event listener.
abortController.abort();
// Cleanup the promise.

@@ -30,0 +30,0 @@ resolve();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc