Skip to content

Commit 5b29bca

Browse files
authored
Merge pull request #397 from Igmat/master
Better commonJs module integration
2 parents 6a6c046 + 5a64ab4 commit 5b29bca

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.1.1",
44
"description": "A JavaScript library for providing multiple simultaneous, stable, fault-tolerant and resumable/restartable uploads via the HTML5 File API.",
55
"main": "resumable.js",
6+
"types": "./resumable.d.ts",
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1"
89
},

resumable.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ declare module Resumable {
158158
**/
159159
dragOverClass?: string;
160160
}
161-
161+
162162
export class Resumable {
163163
constructor(options:ConfigurationHash);
164-
164+
165165
/**
166166
* A boolean value indicator whether or not Resumable.js is supported by the current browser.
167167
**/
@@ -174,10 +174,10 @@ declare module Resumable {
174174
* An array of ResumableFile file objects added by the user (see full docs for this object type below).
175175
**/
176176
files: Array<ResumableFile>;
177-
177+
178178
events: Array<any>;
179179
version: number;
180-
180+
181181
/**
182182
* Assign a browse action to one or more DOM nodes. Pass in true to allow directories to be selected (Chrome only).
183183
**/
@@ -233,7 +233,7 @@ declare module Resumable {
233233
**/
234234
getSize(): void;
235235
getOpt(o: string): any;
236-
236+
237237
// Events
238238
/**
239239
* Listen for event from Resumable.js (see below)
@@ -369,10 +369,10 @@ declare module Resumable {
369369
**/
370370
isComplete: () => boolean;
371371
}
372-
372+
373373
class ResumableChunk {}
374374
}
375375

376376
declare module 'resumablejs' {
377-
export = Resumable.Resumable;
377+
export = Resumable;
378378
}

resumable.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,9 @@
11541154

11551155
// Node.js-style export for Node and Component
11561156
if (typeof module != 'undefined') {
1157+
// left here for backwards compatibility
11571158
module.exports = Resumable;
1159+
module.exports.Resumable = Resumable;
11581160
} else if (typeof define === "function" && define.amd) {
11591161
// AMD/requirejs: Define the module
11601162
define(function(){

0 commit comments

Comments
 (0)