Skip to content

Commit 675ed7b

Browse files
Merge pull request #2084 from NullVoxPopuli/add-has-registration-owner-proxy
Add hasRegistration to owner-proxy
2 parents 431c9b7 + d678ffc commit 675ed7b

File tree

1 file changed

+24
-0
lines changed
  • packages/repl-sdk/src/compilers/ember

1 file changed

+24
-0
lines changed

packages/repl-sdk/src/compilers/ember/owner.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,29 @@ export function makeOwner(owner) {
2626

2727
return owner.resolveRegistration(name);
2828
},
29+
30+
/**
31+
* @param {string} name
32+
*/
33+
hasRegistration(name) {
34+
if (typeof owner !== 'object') return;
35+
if (!owner) return;
36+
if (!('hasRegistration' in owner)) return;
37+
if (typeof owner.hasRegistration !== 'function') return;
38+
39+
return owner.hasRegistration(name);
40+
},
41+
42+
/**
43+
* @param {string} name
44+
*/
45+
factoryFor(name) {
46+
if (typeof owner !== 'object') return;
47+
if (!owner) return;
48+
if (!('factoryFor' in owner)) return;
49+
if (typeof owner.factoryFor !== 'function') return;
50+
51+
return owner.factoryFor(name);
52+
},
2953
};
3054
}

0 commit comments

Comments
 (0)