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

pure-upload

Package Overview
Dependencies
Maintainers
2
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pure-upload - npm Package Compare versions

Comparing version 1.0.0 to 1.0.2

22

index.js

@@ -35,2 +35,13 @@ function castFiles(fileList, status) {

};
function newGuid() {
var d = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
}
exports.newGuid = newGuid;
;
var UploadArea = (function () {

@@ -61,12 +72,8 @@ function UploadArea(targetElement, options, uploader) {

this.fileInput.accept = this.options.accept;
this.fileInput.addEventListener("change", function (e) {
_this.putFilesToQueue(e.target.files);
});
if (this.options.multiple) {
this.fileInput.setAttribute("multiple", "");
}
if (this.uploader.uploaderOptions.autoStart) {
this.fileInput.addEventListener("change", function (e) {
console.log("changed");
console.log(e);
_this.putFilesToQueue(e.target.files);
});
}
if (this.options.clickable) {

@@ -275,2 +282,3 @@ this.targetElement.addEventListener("click", function (e) {

_this.queuedFiles.push(file);
file.guid = newGuid();
file.uploadStatus = exports.uploadStatus.queued;

@@ -277,0 +285,0 @@ file.remove = decorateSimpleFunction(file.remove, function () {

@@ -39,2 +39,12 @@ export function castFiles(fileList: File[]| Object, status?:IUploadStatus): IUploadFile[] {

export function newGuid() : string {
var d = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (d + Math.random()*16)%16 | 0;
d = Math.floor(d/16);
return (c=='x' ? r : (r&0x3|0x8)).toString(16);
});
return uuid;
};
export interface IUploadAreaOptions extends IUploadOptions {

@@ -62,2 +72,3 @@ maxFileSize: number;

export interface IUploadFile extends File {
guid: string;
uploadStatus: IUploadStatus;

@@ -132,12 +143,8 @@ responseCode: number;

this.fileInput.accept = this.options.accept;
this.fileInput.addEventListener("change", (e: any) => {
this.putFilesToQueue(e.target.files);
});
if (this.options.multiple) {
this.fileInput.setAttribute("multiple", "");
}
if (this.uploader.uploaderOptions.autoStart) {
this.fileInput.addEventListener("change", (e: any) => {
console.log("changed");
console.log(e);
this.putFilesToQueue(e.target.files);
});
}
if (this.options.clickable) {

@@ -148,3 +155,2 @@ this.targetElement.addEventListener("click", (e) => {

}
if (this.options.allowDragDrop) {

@@ -379,2 +385,3 @@ this.targetElement.addEventListener("dragover", (e: DragEvent) => {

this.queuedFiles.push(file);
file.guid = newGuid();
file.uploadStatus = uploadStatus.queued;

@@ -381,0 +388,0 @@

{
"name": "pure-upload",
"version": "1.0.0",
"version": "1.0.2",
"description": "The pure upload library without dependencies",

@@ -5,0 +5,0 @@ "contributors": [

@@ -6,2 +6,3 @@ declare module "pure-upload" {

export var getUploader: (options: IUploadQueueOptions, callbacks: IUploadQueueCallbacks) => Uploader;
export function newGuid(): string;
export interface IUploadAreaOptions extends IUploadOptions {

@@ -26,2 +27,3 @@ maxFileSize: number;

export interface IUploadFile extends File {
guid: string;
uploadStatus: IUploadStatus;

@@ -28,0 +30,0 @@ responseCode: number;

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