MCPcopy Create free account
hub / github.com/aurelia/binding / locateAPI

Method locateAPI

src/name-expression.js:23–42  ·  view source on GitHub ↗
(element: Element, apiName: string)

Source from the content-addressed store, hash-verified

21 }
22
23 static locateAPI(element: Element, apiName: string): Object {
24 switch (apiName) {
25 case 'element':
26 return element;
27 case 'controller':
28 return getAU(element).controller;
29 case 'view-model':
30 return getAU(element).controller.viewModel;
31 case 'view':
32 return getAU(element).controller.view;
33 default:
34 let target = getAU(element)[apiName];
35
36 if (target === undefined) {
37 throw new Error(`Attempted to reference "${apiName}", but it was not found amongst the target's API.`);
38 }
39
40 return target.viewModel;
41 }
42 }
43}
44
45class NameBinder {

Callers 4

createBindingMethod · 0.80
aurelia-binding.jsFile · 0.80
aurelia-binding.jsFile · 0.80

Calls 1

getAUFunction · 0.70

Tested by

no test coverage detected