Code Monkey home page Code Monkey logo

Comments (23)

berkayk avatar berkayk commented on August 29, 2024 1

Ok, I'll create another project and try again. I am using VSCode on MacOS mojave if it's related.

from robotlegs.

joshtynjala avatar joshtynjala commented on August 29, 2024

For reference, someone tried using Robotlegs with Feathers UI, and depending on which order the Haxelibs appeared in project.xml file, it resulted in compile-time errors like this:

Class<openfl.events.Event> has no field CLEAR

More context in this thread.

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

Hi Josh. I'd have to review to jog my memory, but I believe an early version of OpenGL didn't have event bubbling. Not sure if this is still an issue. I'll make a note to investigate this further today.

from robotlegs.

joshtynjala avatar joshtynjala commented on August 29, 2024

@peteshand Interesting! Thanks for taking a look!

Hopefully, it's just an easy fix where you can exclude the class if a new enough version of OpenFL is being used.

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

Hey @joshtynjala

So yeah originally the OpenFl package was added for the event bubbling issue i mentioned earlier, however I'm pretty sure that this was resolved in OpenFl at some stage. Then I think the package stuck around because both Swiftsuspenders and Robotlegs depend on a few OpenFl classes, mainly to do with events, however Robotlegs can be used without openFL, and sometimes on targets where OpenFl doesn't run, so that's the reason for the openFL package.

But I agree it's not ideal to have conflicting classes. I've updated the event and applicationDomain classes to typedef to the native OpenFl classes when open is being used and fallback to polyfils when OpenFl isn't being used.

New versions of Robotlegs and Swiftsuspenders can be downloaded from haxelib.
haxelib install robotlegs 2.0.0
haxelib install swiftsuspenders 1.1.0

from robotlegs.

berkayk avatar berkayk commented on August 29, 2024

After upgrading robotlegs to 2.0.0, I started getting Type not found : polyfill.events.Event and build fails. What is the reason?

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

@berkayk did you update swiftsuspenders as well?

from robotlegs.

berkayk avatar berkayk commented on August 29, 2024

Yes, it was automatically downloaded to 1.1.0 and I re-set to 1.1.0 version.

<haxelib name="openfl" />
<haxelib name="actuate" />
<haxelib name="signals" />
<haxelib name="swiftsuspenders" />
<haxelib name="robotlegs" />
<haxelib name="feathersui" />

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

What platform are you targeting?
What does the generated hxml file look like?

from robotlegs.

berkayk avatar berkayk commented on August 29, 2024

I am targeting HTML5.

-main ApplicationMain 
--macro lime._internal.macros.DefineMacro.run()
-cp /usr/local/lib/haxe/lib/lime/7,8,0/src
-D lime=7.8.0
-cp /usr/local/lib/haxe/lib/signals/1,3,2/src
-D signals=1.3.2
-cp /usr/local/lib/haxe/lib/robotlegs/2,0,0/src
-D robotlegs=2.0.0
-cp /usr/local/lib/haxe/lib/swiftsuspenders/1,1,0/src
-D swiftsuspenders=1.1.0
-cp /usr/local/lib/haxe/lib/feathersui/1,0,0-alpha,2/src
-D feathersui=1.0.0-alpha.2
-cp /usr/local/lib/haxe/lib/actuate/1,8,9/src
-D actuate=1.8.9
-cp /usr/local/lib/haxe/lib/hxargs/3,0,2
-D hxargs=3.0.2
--macro openfl._internal.macros.ExtraParams.include()
-cp /usr/local/lib/haxe/lib/openfl/8,9,7/src
-D openfl=8.9.7
-cp src
-D MAC_USE_CURRENT_SDK=1
-D tools=7.8.0
-D lime-canvas
-D howlerjs
-D no-compilation
-D openfl-html5
-D lime-webgl
-D lime-dom
-D lime-howlerjs
-D lime-html5
-D html5
-D web
--remap flash:openfl
--connect
6000
-js build/html5/bin/MyApplication.js
-cp build/html5/haxe
-D html5

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

Also in what class is the error happening?
Do you have error stack

from robotlegs.

berkayk avatar berkayk commented on August 29, 2024

This is how I initialize.

_context = new Context().install(MVCSBundle).configure(ModelConfig).configure(new ContextView(this));

and ModelConfig.hx is

class ModelConfig implements IConfig {
	@inject public var injector:IInjector;

	public function new() {}

	public function configure() {
		injector.map(UsersModel).asSingleton();
		trace("Initialized ModelConfig");
	}
}

Here is the error stack.

/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/framework/api/IInjector.hx:9: characters 8-40 : Type not found : polyfill.events.IEventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/framework/api/IInjector.hx:10: characters 8-41 : Type not found : polyfill.system.ApplicationDomain
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/bundles/mvcs/Mediator.hx:9: characters 8-29 : Type not found : polyfill.events.Event
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/bundles/mvcs/Mediator.hx:10: characters 8-40 : Type not found : polyfill.events.IEventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/localEventMap/api/IEventMap.hx:9: characters 8-40 : Type not found : polyfill.events.IEventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/framework/api/IContext.hx:9: characters 8-40 : Type not found : polyfill.events.IEventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/contextView/StageSyncExtension.hx:10: characters 8-29 : Type not found : polyfill.events.Event
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/viewManager/api/IViewManager.hx:9: characters 8-40 : Type not found : polyfill.events.IEventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/modularity/ModularityExtension.hx:10: characters 8-29 : Type not found : polyfill.events.Event
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/modularity/impl/ModularContextEvent.hx:9: characters 8-29 : Type not found : polyfill.events.Event
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/modularity/impl/ModuleConnector.hx:9: characters 8-39 : Type not found : polyfill.events.EventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/modularity/impl/ModuleConnector.hx:10: characters 8-40 : Type not found : polyfill.events.IEventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/viewManager/impl/ViewManagerEvent.hx:10: characters 8-29 : Type not found : polyfill.events.Event
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/viewManager/impl/ContainerBinding.hx:11: characters 8-39 : Type not found : polyfill.events.EventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/viewManager/impl/ContainerRegistry.hx:11: characters 8-39 : Type not found : polyfill.events.EventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/viewManager/impl/StageObserver.hx:11: characters 8-29 : Type not found : polyfill.events.Event
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/viewManager/impl/ViewManager.hx:10: characters 8-39 : Type not found : polyfill.events.EventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/extensions/viewProcessorMap/impl/ViewProcessorFactory.hx:10: characters 8-29 : Type not found : polyfill.events.Event
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/framework/impl/Context.hx:10: characters 8-39 : Type not found : polyfill.events.EventDispatcher
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/framework/api/LifecycleEvent.hx:10: characters 8-29 : Type not found : polyfill.events.Event
/usr/local/lib/haxe/lib/robotlegs/2,0,0/src/robotlegs/bender/framework/impl/Context.hx:43: characters 23-38 : Type not found : EventDispatcher

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

Hmmmm unfortunately I can't reproduce the issue.
I'm testing _context = new Context().install(MVCSBundle).configure(ModelConfig).configure(new ContextView(this));
with the libs you have and it's compiling.

You might need to provide a barebones project

from robotlegs.

berkayk avatar berkayk commented on August 29, 2024

What do you mean by barebones project?

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

I can't reproduce the error you're seeing.
swiftsuspenders 1.1.0 has the polyfill.events.Event class, so I'm not sure why the compiler isn't seeing it.
If you want to share a complete project that produces the error I can take a look.

from robotlegs.

berkayk avatar berkayk commented on August 29, 2024

@peteshand can you provide your UsersModel class?

My current UsersModel class looks like

import org.swiftsuspenders.utils.DescribedType;

class UsersModel implements DescribedType {
	public var name:String;
	public var id:String;

	public function new() {}
}

from robotlegs.

berkayk avatar berkayk commented on August 29, 2024

In the fresh project https://github.com/berkayk/haxe-openfl-starter-test, I am currently getting

org/swiftsuspenders/reflection/DescribeTypeRTTIReflector.hx:318: metadata missing for ModelConfig
Classes with injectables must implement DescribedType
MyApplication.js:10830
org/swiftsuspenders/errors/InjectorError.hx:13: [Error: ,Injector is missing a mapping to handle injection into property "injector" of object "ModelConfig" with type "ModelConfig". Target dependency: "injector|",0]

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

Any class that you inject into needs to implement DescribedType

So your ModelConfig should probably look like this:

class ModelConfig implements IConfig implements DescribedType {
	@inject public var example:Example;

	public function configure():Void {
		...
	}
}

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

you can also use the @:rtti metadata, however this will run at runtime instead of compile time, so I'd recommend using DescribedType.

@:rtti
class ModelConfig implements IConfig {
	@inject public var example:Example;

	public function configure():Void {
		...
	}
}

from robotlegs.

berkayk avatar berkayk commented on August 29, 2024

I had no idea what @:rtti meant :)
SInce I haven't seen any DescribedType on examples. I got lost because of that.

Thanks again, it is working now 🎉

from robotlegs.

peteshand avatar peteshand commented on August 29, 2024

Yeah, I really need to put some updated examples together.

FYI
rtti = Runtime Type Information, which basically just embeds metadata within classes for run parsing.
implementing DescribedType will do this at compile time and as a result is much faster when projects scale up.

from robotlegs.

berkayk avatar berkayk commented on August 29, 2024

@peteshand Thanks for the clarification.

from robotlegs.

joshtynjala avatar joshtynjala commented on August 29, 2024

Thank you!

from robotlegs.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.