New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@github/file-attachment-element

Package Overview
Dependencies
Maintainers
14
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@github/file-attachment-element - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

14

dist/attachment.d.ts
export default class Attachment {
file: File;
directory: string | undefined;
state: 'pending' | 'saving' | 'saved';
id: string | null;
href: string | null;
name: string | null;
percent: number;
static traverse(transfer: DataTransfer, directory: boolean): Promise<Attachment[]>;

@@ -9,2 +14,11 @@ static from(files: File[] | Attachment[] | FileList): Attachment[];

isImage(): boolean;
saving(percent: number): void;
saved(attributes?: {
id?: string | null;
href?: string | null;
name?: string | null;
}): void;
isPending(): boolean;
isSaving(): boolean;
isSaved(): boolean;
}

@@ -5,2 +5,7 @@ export default class Attachment {

this.directory = directory;
this.state = 'pending';
this.id = null;
this.href = null;
this.name = null;
this.percent = 0;
}

@@ -31,2 +36,28 @@ static traverse(transfer, directory) {

}
saving(percent) {
if (this.state !== 'pending' && this.state !== 'saving') {
throw new Error(`Unexpected transition from ${this.state} to saving`);
}
this.state = 'saving';
this.percent = percent;
}
saved(attributes) {
var _a, _b, _c, _d, _e, _f;
if (this.state !== 'pending' && this.state !== 'saving') {
throw new Error(`Unexpected transition from ${this.state} to saved`);
}
this.state = 'saved';
this.id = (_b = (_a = attributes) === null || _a === void 0 ? void 0 : _a.id, (_b !== null && _b !== void 0 ? _b : null));
this.href = (_d = (_c = attributes) === null || _c === void 0 ? void 0 : _c.href, (_d !== null && _d !== void 0 ? _d : null));
this.name = (_f = (_e = attributes) === null || _e === void 0 ? void 0 : _e.name, (_f !== null && _f !== void 0 ? _f : null));
}
isPending() {
return this.state === 'pending';
}
isSaving() {
return this.state === 'saving';
}
isSaved() {
return this.state === 'saved';
}
}

@@ -33,0 +64,0 @@ function transferredFiles(transfer, directory) {

@@ -5,2 +5,7 @@ class Attachment {

this.directory = directory;
this.state = 'pending';
this.id = null;
this.href = null;
this.name = null;
this.percent = 0;
}

@@ -31,2 +36,28 @@ static traverse(transfer, directory) {

}
saving(percent) {
if (this.state !== 'pending' && this.state !== 'saving') {
throw new Error(`Unexpected transition from ${this.state} to saving`);
}
this.state = 'saving';
this.percent = percent;
}
saved(attributes) {
var _a, _b, _c, _d, _e, _f;
if (this.state !== 'pending' && this.state !== 'saving') {
throw new Error(`Unexpected transition from ${this.state} to saved`);
}
this.state = 'saved';
this.id = (_b = (_a = attributes) === null || _a === void 0 ? void 0 : _a.id, (_b !== null && _b !== void 0 ? _b : null));
this.href = (_d = (_c = attributes) === null || _c === void 0 ? void 0 : _c.href, (_d !== null && _d !== void 0 ? _d : null));
this.name = (_f = (_e = attributes) === null || _e === void 0 ? void 0 : _e.name, (_f !== null && _f !== void 0 ? _f : null));
}
isPending() {
return this.state === 'pending';
}
isSaving() {
return this.state === 'saving';
}
isSaved() {
return this.state === 'saved';
}
}

@@ -33,0 +64,0 @@ function transferredFiles(transfer, directory) {

@@ -11,2 +11,7 @@ (function (global, factory) {

this.directory = directory;
this.state = 'pending';
this.id = null;
this.href = null;
this.name = null;
this.percent = 0;
}

@@ -37,2 +42,28 @@ static traverse(transfer, directory) {

}
saving(percent) {
if (this.state !== 'pending' && this.state !== 'saving') {
throw new Error(`Unexpected transition from ${this.state} to saving`);
}
this.state = 'saving';
this.percent = percent;
}
saved(attributes) {
var _a, _b, _c, _d, _e, _f;
if (this.state !== 'pending' && this.state !== 'saving') {
throw new Error(`Unexpected transition from ${this.state} to saved`);
}
this.state = 'saved';
this.id = (_b = (_a = attributes) === null || _a === void 0 ? void 0 : _a.id, (_b !== null && _b !== void 0 ? _b : null));
this.href = (_d = (_c = attributes) === null || _c === void 0 ? void 0 : _c.href, (_d !== null && _d !== void 0 ? _d : null));
this.name = (_f = (_e = attributes) === null || _e === void 0 ? void 0 : _e.name, (_f !== null && _f !== void 0 ? _f : null));
}
isPending() {
return this.state === 'pending';
}
isSaving() {
return this.state === 'saving';
}
isSaved() {
return this.state === 'saved';
}
}

@@ -39,0 +70,0 @@ function transferredFiles(transfer, directory) {

8

package.json
{
"name": "@github/file-attachment-element",
"version": "0.1.0",
"version": "0.2.0",
"description": "Attach files via drag and drop or file input.",

@@ -20,3 +20,3 @@ "main": "dist/index.umd.js",

"pretest": "npm run build",
"test": "karma start test/karma.config.js",
"test": "karma start karma.config.js",
"prepublishOnly": "npm run build",

@@ -35,5 +35,5 @@ "postpublish": "npm publish --ignore-scripts --@github:registry='https://npm.pkg.github.com'"

"mocha": "^7.0.0",
"rollup": "^1.28.0",
"typescript": "^3.7.4"
"rollup": "^1.29.1",
"typescript": "^3.7.5"
}
}
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