ember-getowner-polyfill
Advanced tools
Comparing version 2.2.0 to 3.0.0
@@ -1,2 +0,1 @@ | ||
/* eslint-env node */ | ||
'use strict'; | ||
@@ -3,0 +2,0 @@ |
@@ -1,2 +0,1 @@ | ||
/* eslint-env node */ | ||
'use strict'; | ||
@@ -8,4 +7,4 @@ | ||
module.exports = { | ||
name: 'ember-getowner-polyfill', | ||
included: function() { | ||
name: require('./package').name, | ||
included() { | ||
this._super.included.apply(this, arguments); | ||
@@ -26,3 +25,3 @@ | ||
_ensureThisImport: function() { | ||
_ensureThisImport() { | ||
if (!this.import) { | ||
@@ -29,0 +28,0 @@ this._findHost = function findHostShim() { |
103
package.json
{ | ||
"name": "ember-getowner-polyfill", | ||
"version": "2.2.0", | ||
"version": "3.0.0", | ||
"description": "The default blueprint for ember-cli addons.", | ||
@@ -8,17 +8,28 @@ "keywords": [ | ||
], | ||
"homepage": "https://github.com/rwjblue/ember-getowner-polyfill#readme", | ||
"bugs": { | ||
"url": "https://github.com/rwjblue/ember-getowner-polyfill/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/rwjblue/ember-getowner-polyfill.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Robert Jackson <me@rwjblue.com>", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/rwjblue/ember-getowner-polyfill.git" | ||
}, | ||
"scripts": { | ||
"build": "ember build", | ||
"start": "ember server", | ||
"test": "ember try:testall" | ||
"build": "ember build --environment=production", | ||
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*", | ||
"lint:hbs": "ember-template-lint .", | ||
"lint:js": "eslint .", | ||
"start": "ember serve", | ||
"test": "npm-run-all lint:* test:*", | ||
"test:ember": "ember test", | ||
"test:ember-compatibility": "ember try:each" | ||
}, | ||
"dependencies": { | ||
"ember-cli-htmlbars": "^4.3.1", | ||
"ember-cli-version-checker": "^2.1.0", | ||
@@ -28,32 +39,43 @@ "ember-factory-for-polyfill": "^1.3.1" | ||
"devDependencies": { | ||
"broccoli-asset-rev": "^2.4.5", | ||
"ember-ajax": "^3.0.0", | ||
"ember-cli": "~2.16.2", | ||
"ember-cli-babel": "^6.6.0", | ||
"ember-cli-content-security-policy": "0.5.0", | ||
"ember-cli-dependency-checker": "^2.0.0", | ||
"ember-cli-eslint": "^4.0.0", | ||
"ember-cli-htmlbars": "^2.0.1", | ||
"ember-cli-htmlbars-inline-precompile": "^1.0.2", | ||
"ember-cli-inject-live-reload": "^1.4.1", | ||
"ember-cli-qunit": "^4.0.0", | ||
"ember-cli-shims": "^1.1.0", | ||
"ember-cli-sri": "^2.1.0", | ||
"ember-cli-uglify": "^2.0.0", | ||
"@ember/optional-features": "^1.3.0", | ||
"@glimmer/component": "^1.0.0", | ||
"@glimmer/tracking": "^1.0.0", | ||
"babel-eslint": "^10.1.0", | ||
"bower": "^1.8.8", | ||
"broccoli-asset-rev": "^3.0.0", | ||
"ember-auto-import": "^1.5.3", | ||
"ember-cli": "~3.18.0", | ||
"ember-cli-babel": "^7.19.0", | ||
"ember-cli-dependency-checker": "^3.2.0", | ||
"ember-cli-inject-live-reload": "^2.0.2", | ||
"ember-cli-shims": "^1.2.0", | ||
"ember-cli-sri": "^2.1.1", | ||
"ember-cli-uglify": "^3.0.0", | ||
"ember-debug-handlers-polyfill": "^1.0.3", | ||
"ember-disable-prototype-extensions": "^1.1.2", | ||
"ember-export-application-global": "^2.0.0", | ||
"ember-load-initializers": "^1.0.0", | ||
"ember-resolver": "^4.0.0", | ||
"ember-source": "~2.16.0", | ||
"loader.js": "^4.2.3" | ||
"ember-disable-prototype-extensions": "^1.1.3", | ||
"ember-export-application-global": "^2.0.1", | ||
"ember-load-initializers": "^2.1.1", | ||
"ember-maybe-import-regenerator": "^0.1.6", | ||
"ember-qunit": "^4.6.0", | ||
"ember-resolver": "^8.0.0", | ||
"ember-source-channel-url": "^2.0.1", | ||
"ember-template-lint": "^2.6.0", | ||
"ember-try": "^1.4.0", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"loader.js": "^4.7.0", | ||
"npm-run-all": "^4.1.5", | ||
"qunit-dom": "^1.2.0", | ||
"release-it": "^13.5.7", | ||
"release-it-lerna-changelog": "^2.3.0" | ||
}, | ||
"engines": { | ||
"node": "^4.5 || 6.* || >= 7.*" | ||
"node": "10.* || >= 12" | ||
}, | ||
"homepage": "https://github.com/rwjblue/ember-getowner-polyfill#readme", | ||
"bugs": { | ||
"url": "https://github.com/rwjblue/ember-getowner-polyfill/issues" | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org" | ||
}, | ||
"main": "index.js", | ||
"ember": { | ||
"edition": "octane" | ||
}, | ||
"ember-addon": { | ||
@@ -63,3 +85,18 @@ "configPath": "tests/dummy/config", | ||
"after": "ember-factory-for-polyfill" | ||
}, | ||
"release-it": { | ||
"plugins": { | ||
"release-it-lerna-changelog": { | ||
"infile": "CHANGELOG.md", | ||
"launchEditor": true | ||
} | ||
}, | ||
"git": { | ||
"tagName": "v${version}" | ||
}, | ||
"github": { | ||
"release": true, | ||
"tokenRef": "GITHUB_AUTH" | ||
} | ||
} | ||
} |
# ember-getowner-polyfill | ||
This provides a polyfill for the `Ember.getOwner` feature added in Ember 2.3. | ||
This provides a polyfill for the `Ember.getOwner` and `Ember.setOwner` features | ||
added in Ember 2.3. | ||
@@ -5,0 +6,0 @@ ## Installation |
@@ -12,6 +12,11 @@ /* globals Ember, require */ | ||
var OWNER; | ||
if (!_Ember.getOwner || !_Ember.setOwner) { | ||
OWNER = '__' + (Date.now()) + '_owner'; | ||
} | ||
if (!_Ember.getOwner) { | ||
var CONTAINER = '__' + (Date.now()) + '_container'; | ||
var REGISTRY = '__' + (Date.now()) + '_registry'; | ||
var OWNER = '__' + (Date.now()) + '_owner'; | ||
var SAFE_LOOKUP_FACTORY_METHOD = '__' + (Date.now()) + '_lookupFactory'; | ||
@@ -157,15 +162,34 @@ | ||
function getOwner(object) { | ||
if (object[OWNER]) { | ||
return object[OWNER]; | ||
} | ||
// Fallback to finding the owner on the container | ||
var container = object.container; | ||
if (!container) { return; } | ||
if (!container[OWNER]) { | ||
var owner = new FakeOwner(object); | ||
container[OWNER] = owner; | ||
} | ||
return container[OWNER]; | ||
} | ||
Object.defineProperty(_Ember, 'getOwner', { | ||
get: function() { | ||
return function(object) { | ||
var container = object.container; | ||
if (!container) { return; } | ||
return getOwner; | ||
} | ||
}); | ||
} | ||
if (!container[OWNER]) { | ||
var owner = new FakeOwner(object); | ||
container[OWNER] = owner; | ||
} | ||
if (!_Ember.setOwner) { | ||
function setOwner(object, owner) { | ||
object[OWNER] = owner; | ||
} | ||
return container[OWNER]; | ||
}; | ||
Object.defineProperty(_Ember, 'setOwner', { | ||
get: function() { | ||
return setOwner; | ||
} | ||
@@ -172,0 +196,0 @@ }); |
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
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
10
198
89
15184
3
31
37694
+ Addedember-cli-htmlbars@^4.3.1
+ Added@ember/edition-utils@1.2.0(transitive)
+ Added@types/minimatch@3.0.5(transitive)
+ Added@types/symlink-or-copy@1.2.2(transitive)
+ Addedasync@2.6.4(transitive)
+ Addedasync-disk-cache@1.3.5(transitive)
+ Addedasync-promise-queue@1.0.5(transitive)
+ Addedbabel-plugin-htmlbars-inline-precompile@3.2.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbinaryextensions@2.3.0(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbroccoli-debug@0.6.5(transitive)
+ Addedbroccoli-kitchen-sink-helpers@0.3.1(transitive)
+ Addedbroccoli-node-api@1.7.0(transitive)
+ Addedbroccoli-node-info@2.2.0(transitive)
+ Addedbroccoli-output-wrapper@2.0.0(transitive)
+ Addedbroccoli-persistent-filter@2.3.1(transitive)
+ Addedbroccoli-plugin@1.3.13.1.0(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcommon-tags@1.8.2(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addededitions@1.3.4(transitive)
+ Addedember-cli-babel-plugin-helpers@1.1.1(transitive)
+ Addedember-cli-htmlbars@4.5.0(transitive)
+ Addedensure-posix-path@1.1.1(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfs-extra@8.1.0(transitive)
+ Addedfs-merger@3.2.1(transitive)
+ Addedfs-tree-diff@0.5.92.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedglob@5.0.157.2.3(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhash-for-dep@1.5.1(transitive)
+ Addedheimdalljs@0.2.6(transitive)
+ Addedheimdalljs-logger@0.1.10(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedistextorbinary@2.1.0(transitive)
+ Addedjson-stable-stringify@1.1.1(transitive)
+ Addedjsonfile@4.0.0(transitive)
+ Addedjsonify@0.0.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmatcher-collection@1.1.22.0.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedmktemp@0.4.0(transitive)
+ Addedms@2.0.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-posix@1.0.0(transitive)
+ Addedpath-root@0.1.1(transitive)
+ Addedpath-root-regex@0.1.2(transitive)
+ Addedpromise-map-series@0.2.3(transitive)
+ Addedquick-temp@0.1.8(transitive)
+ Addedresolve-package-path@1.2.7(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedrsvp@3.2.13.6.24.8.5(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedsprintf-js@1.1.3(transitive)
+ Addedstrip-bom@4.0.0(transitive)
+ Addedsymlink-or-copy@1.3.1(transitive)
+ Addedsync-disk-cache@1.3.4(transitive)
+ Addedtextextensions@2.6.0(transitive)
+ Addedtree-sync@1.4.0(transitive)
+ Addedunderscore.string@3.3.6(transitive)
+ Addeduniversalify@0.1.2(transitive)
+ Addedusername-sync@1.0.3(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwalk-sync@0.3.41.1.42.2.0(transitive)
+ Addedwrappy@1.0.2(transitive)