aurelia-pal-nodejs
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2
/** | ||
* Initializes the PAL with the Browser-targeted implementation. | ||
* Initializes the PAL with the NodeJS-targeted implementation. | ||
*/ | ||
export declare function initialize(): void; |
"use strict"; | ||
const aurelia_pal_1 = require('aurelia-pal'); | ||
const nodejs_platform_1 = require('./nodejs-platform'); | ||
const nodejs_feature_1 = require('./nodejs-feature'); | ||
const nodejs_dom_1 = require('./nodejs-dom'); | ||
const jsdom_1 = require('jsdom'); | ||
const nodejs_pal_builder_1 = require('./nodejs-pal-builder'); | ||
let isInitialized = false; | ||
/** | ||
* Initializes the PAL with the Browser-targeted implementation. | ||
* Initializes the PAL with the NodeJS-targeted implementation. | ||
*/ | ||
@@ -16,14 +13,10 @@ function initialize() { | ||
isInitialized = true; | ||
var _global = jsdom_1.jsdom(undefined, {}).defaultView; | ||
ensurePerformance(_global.window); | ||
var _platform = new nodejs_platform_1.NodeJsPlatform(_global); | ||
var _dom = new nodejs_dom_1.NodeJsDom(_global); | ||
var _feature = new nodejs_feature_1.NodeJsFeature(_global); | ||
let pal = nodejs_pal_builder_1.buildPal(); | ||
aurelia_pal_1.initializePAL((platform, feature, dom) => { | ||
Object.assign(platform, _platform); | ||
Object.setPrototypeOf(platform, _platform.constructor.prototype); | ||
Object.assign(dom, _dom); | ||
Object.setPrototypeOf(dom, _dom.constructor.prototype); | ||
Object.assign(feature, _feature); | ||
Object.setPrototypeOf(feature, _feature.constructor.prototype); | ||
Object.assign(platform, pal.platform); | ||
Object.setPrototypeOf(platform, pal.platform.constructor.prototype); | ||
Object.assign(dom, pal.dom); | ||
Object.setPrototypeOf(dom, pal.dom.constructor.prototype); | ||
Object.assign(feature, pal.feature); | ||
Object.setPrototypeOf(feature, pal.feature.constructor.prototype); | ||
(function (global) { | ||
@@ -54,6 +47,6 @@ global.console = global.console || {}; | ||
get: function () { | ||
return _global.document.title; | ||
return pal.global.document.title; | ||
}, | ||
set: function (value) { | ||
_global.document.title = value; | ||
pal.global.document.title = value; | ||
} | ||
@@ -63,3 +56,3 @@ }); | ||
get: function () { | ||
return _global.document.activeElement; | ||
return pal.global.document.activeElement; | ||
} | ||
@@ -69,3 +62,3 @@ }); | ||
get: function () { | ||
return _global.XMLHttpRequest; | ||
return pal.global.XMLHttpRequest; | ||
} | ||
@@ -76,17 +69,3 @@ }); | ||
exports.initialize = initialize; | ||
function ensurePerformance(window) { | ||
if (window.performance === undefined) { | ||
window.performance = {}; | ||
} | ||
if (window.performance.now === undefined) { | ||
let nowOffset = Date.now(); | ||
//if (performance.timing && performance.timing.navigationStart) { | ||
// nowOffset = performance.timing.navigationStart; | ||
//} | ||
window.performance.now = function now() { | ||
return Date.now() - nowOffset; | ||
}; | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
import { IDom } from './dom'; | ||
import { IGlobal } from './global'; | ||
import { NodeJsMutationEmulator } from './nodejs-mutation-emulator'; | ||
/** | ||
@@ -9,3 +8,2 @@ * Represents the core APIs of the DOM. | ||
global: IGlobal; | ||
mutationEmulator: NodeJsMutationEmulator; | ||
constructor(global: IGlobal); | ||
@@ -12,0 +10,0 @@ Element: { |
"use strict"; | ||
const nodejs_mutation_emulator_1 = require('./nodejs-mutation-emulator'); | ||
const nodejs_mutation_observer_1 = require('./nodejs-mutation-observer'); | ||
/** | ||
@@ -15,3 +13,2 @@ * Represents the core APIs of the DOM. | ||
this.SVGElement = global.SVGElement; | ||
this.mutationEmulator = new nodejs_mutation_emulator_1.NodeJsMutationEmulator(); | ||
} | ||
@@ -37,3 +34,3 @@ addEventListener(eventName, callback, capture) { | ||
createMutationObserver(callback) { | ||
return this.global.window.MutationObserver || (this.mutationEmulator != null) ? new nodejs_mutation_observer_1.NodeJsMutationObserver(this.mutationEmulator, callback) : null; | ||
return new (this.global.window.MutationObserver)(callback); | ||
} | ||
@@ -40,0 +37,0 @@ createCustomEvent(eventType, options) { |
{ | ||
"name": "aurelia-pal-nodejs", | ||
"description": "node-js implementation of the aurelia pal-abstraction layer", | ||
"author": "Meirion Hughes <crakinshot@yahoo.com>", | ||
"version": "1.0.0-alpha.2", | ||
"description": "The Node.js-specific implementation of Aurelia's platform abstraction layer.", | ||
"keywords": [ | ||
"aurelia", | ||
"pal", | ||
"nodejs" | ||
], | ||
"homepage": "http://aurelia.io", | ||
"bugs": { | ||
"url": "https://github.com/aurelia/pal-nodejs/issues" | ||
}, | ||
"license": "MIT", | ||
"main": "./dist/index.js", | ||
"typings": "./dist/index.d.ts", | ||
"version": "1.0.0-alpha.1", | ||
"author": "Rob Eisenberg <rob@bluespire.com> (http://robeisenberg.com/)", | ||
"contributors": [ | ||
"Meirion Hughes <crakinshot@yahoo.com> (https://github.com/MeirionHughes)", | ||
"Martin Gustafsson <gusten86@gmail.com> (https://github.com/martingust)", | ||
"Devan Patel (https://github.com/devanp92)" | ||
], | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
"test": "gulp clean && gulp build && gulp test && gulp clean:spec" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/aurelia/pal-nodejs" | ||
"url": "http://github.com/aurelia/pal-nodejs" | ||
}, | ||
"dependencies": { | ||
"aurelia-pal": "^1.0.0", | ||
"jsdom": "^9.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/jasmine": "^2.2.34", | ||
"@types/jsdom": "^2.0.29", | ||
"aurelia-tools": "^0.2.4", | ||
"gulp": "^3.9.1", | ||
"gulp-babel": "^6.1.2", | ||
"gulp-bump": "^2.2.0", | ||
"gulp-concat": "^2.6.0", | ||
"gulp-conventional-changelog": "^1.1.0", | ||
"gulp-eslint": "^3.0.1", | ||
"gulp-ignore": "^2.0.1", | ||
"gulp-insert": "^0.5.0", | ||
"gulp-jasmine": "^2.3.0", | ||
"gulp-plumber": "^1.1.0", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-replace": "^0.5.4", | ||
"gulp-rimraf": "^0.2.0", | ||
"gulp-shell": "^0.5.2", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-typescript": "^2.13.4", | ||
"jasmine": "^2.4.1", | ||
"gulp-tslint": "^6.1.2", | ||
"gulp-typedoc": "^2.0.0", | ||
"gulp-typedoc-extractor": "^0.0.8", | ||
"gulp-typescript": "^3.0.1", | ||
"gulp-typescript-formatter": "^0.1.3", | ||
"gulp-util": "^3.0.7", | ||
"jasmine-core": "^2.4.1", | ||
"merge2": "^1.0.2", | ||
"run-sequence": "^1.2.1", | ||
"typings": "^1.0.4" | ||
"object.assign": "^4.0.4", | ||
"require-dir": "^0.3.0", | ||
"run-sequence": "^1.2.2", | ||
"through2": "^2.0.1", | ||
"tslint": "^3.15.1", | ||
"typedoc": "^0.4.4", | ||
"typescript": "^2.0.0", | ||
"typescript-formatter": "^3.0.1", | ||
"vinyl": "^1.1.1", | ||
"vinyl-paths": "^2.1.0", | ||
"yargs": "^4.8.1" | ||
}, | ||
"scripts": { | ||
"test": "gulp test" | ||
}, | ||
"dependencies": { | ||
"aurelia-pal": "^1.0.0", | ||
"jsdom": "^9.2.1" | ||
"aurelia": { | ||
"documentation": { | ||
"articles": [] | ||
} | ||
} | ||
} |
@@ -8,3 +8,3 @@ # aurelia-pal-nodejs | ||
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/) and [our email list](http://durandal.us10.list-manage1.com/subscribe?u=dae7661a3872ee02b519f6f29&id=3de6801ccc). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. You can get an overview of all Aurelia work by visiting [the framework board](https://github.com/aurelia/framework#boards). | ||
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.aurelia.io/) and [our email list](http://eepurl.com/ces50j). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss) or use [stack overflow](http://stackoverflow.com/search?q=aurelia). Documentation can be found [in our developer hub](http://aurelia.io/hub.html). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. | ||
@@ -35,2 +35,2 @@ ## Platform Support | ||
``` | ||
5. You will find the compiled code in the `dist` folder, available in CommonJS module format. | ||
5. You will find the compiled code in the `dist` folder in CommonJS module format. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
87433
40
2175
0
1
36