File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1
1
let counter = 0 ;
2
2
let scriptMap = new Map ( ) ;
3
3
4
- export const ScriptCache = ( function ( global ) {
5
- return function ScriptCache ( scripts ) {
4
+ export const ScriptCache = ( function ( global ) {
5
+ 'use strict' ;
6
+ const ScriptCache = function ( scripts ) {
6
7
const Cache = { }
7
8
8
9
Cache . _onLoad = function ( key ) {
@@ -97,6 +98,21 @@ export const ScriptCache = (function(global) {
97
98
98
99
return Cache ;
99
100
}
100
- } ) ( window )
101
+
102
+ // AMD support
103
+ if ( typeof define === 'function' && define . amd ) {
104
+ define ( function ( ) { return ScriptCache ; } ) ;
105
+ // CommonJS and Node.js module support.
106
+ } else if ( typeof exports !== 'undefined' ) {
107
+ // Support Node.js specific `module.exports` (which can be a function)
108
+ if ( typeof module !== 'undefined' && module . exports ) {
109
+ exports = module . exports = ScriptCache ;
110
+ }
111
+ // But always support CommonJS module 1.1.1 spec (`exports` cannot be a function)
112
+ exports . ScriptCache = ScriptCache ;
113
+ } else {
114
+ global . ScriptCache = ScriptCache ;
115
+ }
116
+ } ) ( this ) ;
101
117
102
118
export default ScriptCache ;
Original file line number Diff line number Diff line change 1
1
import { expect } from 'chai'
2
2
import sinon from 'sinon'
3
- import { ScriptCache } from './ScriptCache'
3
+ import ScriptCache from './ScriptCache'
4
4
5
5
describe ( 'Cache' , ( ) => {
6
6
let cache = [ ] ;
You can’t perform that action at this time.
0 commit comments