Comments (4)
You're right that @:uiComp is mostly optional now. But it might still be used I think since you can customize the way the components names are resolved into classes by using domkit.Macros.registerComponentsPath at --init time
from domkit.
What I don't understand here is why there is an error in the sample above. The documentation states: "Components are resolved by name by adding Comp to the capitalized component name". The xml tag is <something />
, and so according to this rule, by default it should look for SomethingComp
. The class exists and from the error message, it clearly was able to locate the correct class: SomethingComp does not define component something
.
Even if the component is in components.SomethingComp
, and that path is registered using components.$Comp
, it still fails unless SomethingComp is marked with @:uiComp("something")
. If the path components.$Comp
is registered, why does components.SomethingComp
need to be marked explicitly as "something"
if that's the class to which <something />
is meant to resolve to anyway, given it's a registered path to look for components in?
from domkit.
Yeah that's something I didn't deal with. In our games now we're using ui.comp.$ as path so we have exact ClassName == comp-name. I guess when there's no @:uiComp we should try to reverse the class resolution to see if we can find a valid component name before using directly the class name.
from domkit.
Hm, I see. I guess for now to avoid confusion it would be best to rewrite the documentation to suggest a similar setup (i.e. custom registration path with matching class and component names). I tried to have a look at the macros myself, and it seems to me like it would be difficult to change this behaviour without completely rewriting the component resolution system.
If the the class name is kept the same as the component name, i.e. "Something", (in the same package and without registerComponentsPath) gives a slightly different error: Could not load component 'something'
.
I added a trace(RESOLVED_COMPONENTS);
right before this line:
Line 69 in 2b12cb9
It looks like the "something" component gets resolved, beause right before the error, it traces the
RESOLVED_COMPONENTS
map which contains something => {c: domkit.MetaComponent, path: null}
. However, the build still fails with the Could not load component 'something'
error. Maybe something to do with the null
path?
Using the macro debugger, I've discovered that loadComponent("something", ...)
gets called twice. The first time, it fails to load the component, and the second time it succeeds. So, it looks like the error comes from the first time the function is called.
from domkit.
Related Issues (20)
- [Regression] Text node issue HOT 4
- Failed to load module
- Issue with for iterator
- @:uiComp metadata behavior HOT 7
- @:uiInitFunction only works for child classes
- HL bytecode hot reload and DomKit HOT 2
- Domkit License unclear HOT 3
- Adding Bitmap to domkit component, bitmap.dom is null HOT 2
- Transitions HOT 1
- Missing super component registration flow HOT 2
- Array alloc in applyStyle HOT 3
- Multiple CSS files, how to handle HOT 1
- :odd and :even not being refreshed HOT 3
- Uncaught TypeError (JavaScript target) HOT 1
- d9ef202 breaks compilation with the latest released version of haxe HOT 3
- Domkit sample in Heaps + example in docs doesn't compile HOT 4
- domkit css parsing support broken in javascript HOT 3
- A simple component causes: "domkit.Identifier should be String" HOT 1
- Incorrect CSS Id selector for component arrays
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from domkit.