can-globals
Advanced tools
Comparing version 0.0.0-pre.1 to 0.0.0-pre.2
'use strict'; | ||
var Globals = require('./can-globals-proto'); | ||
var QUnit = require('../../test-wrapper'); | ||
var QUnit = require('./test-wrapper'); | ||
var sinon = require('sinon'); | ||
@@ -5,0 +5,0 @@ var globals; |
@@ -1,18 +0,39 @@ | ||
/* global window, document */ | ||
'use strict'; | ||
var global = require('./js/global/global')(); | ||
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill | ||
(function () { | ||
if (typeof global.CustomEvent !== 'function') { | ||
if (typeof global.createEvent !== 'function') { | ||
global.createEvent = function() { | ||
return { | ||
initCustomEvent: function(event, bubbles, cancelable, detail){ | ||
return { | ||
type: event, | ||
bubbles: bubbles, | ||
cancelable: cancelable, | ||
detail: detail | ||
}; | ||
} | ||
}; | ||
}; | ||
} | ||
if ( typeof window.CustomEvent === "function" ) return false; | ||
/*jshint -W082*/ | ||
function CustomEvent (event, params) { | ||
params = params || {bubbles: false, cancelable: false, detail: undefined}; | ||
var evt = global.createEvent('CustomEvent'); | ||
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); | ||
return evt; | ||
} | ||
function CustomEvent ( event, params ) { | ||
params = params || { bubbles: false, cancelable: false, detail: undefined }; | ||
var evt = document.createEvent( 'CustomEvent' ); | ||
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); | ||
return evt; | ||
} | ||
if (typeof global.Event === 'function') { | ||
CustomEvent.prototype = global.Event.prototype; | ||
} else { | ||
var event = global.createEvent('Event'); | ||
/*jshint -W103*/ | ||
CustomEvent.prototype = event.__proto__; | ||
} | ||
CustomEvent.prototype = window.Event.prototype; | ||
window.CustomEvent = CustomEvent; | ||
})(); | ||
global.CustomEvent = CustomEvent; | ||
} |
'use strict'; | ||
var importMap = { | ||
document: require('./document/document'), | ||
global: require('./global/global'), | ||
isBrowserWindow: require('./is-browser-window/is-browser-window') | ||
isBrowserWindow: require('./is-browser-window/is-browser-window'), | ||
location: require('./location/location') | ||
}; | ||
@@ -6,0 +8,0 @@ |
'use strict'; | ||
require('./global/global-test'); | ||
require('./is-browser-window/is-browser-window-test'); | ||
require('./location/location-test'); |
{ | ||
"name": "can-globals", | ||
"version": "0.0.0-pre.1", | ||
"version": "0.0.0-pre.2", | ||
"description": "This module provides a dependency injection container. Modules may define a key and specify a default value (which can be static, cached lazy, or dynamic lazy), but other code can set and reset the value as needed. There is also an event system, for alerting on value changes, both specific to a key and for any key.", | ||
@@ -5,0 +5,0 @@ "main": "can-globals.js", |
Sorry, the diff of this file is not supported yet
23517
28
597