Open fmsouza opened 10 years ago
Thanks for the feedback, Fred. I will check on requirejs compatibility and update you if I can make a quick fix.
Thank very much, Yaroslav! I'll really appreciate if you solve it for me :)
Heres a working example. http://jsfiddle.net/yaroslavya/VXFgG/1/ I only added amd handling and made an export to initialize my bindings with knockout and knockouch. I would include AMD version into github repository. But currently you need to inject one of the touch libraries anyway [zepto, jquery.mobile, hammer], and as it can be any of these I dont want to include multiple dependnecies. Let me know if you need any help with the demo or adopting it to your codebase.
Thank you very much, Yaroslav! It worked here in my code! :) The only thing is that I can't add Hammer through requireJS either. I had to hardcode it in my index page. If I try to load it through require, it says the touch library couldn't be found. Why does it happen?
Thats because theres 3 optional dependencies and Hammer is one of them. I`ll think how to workaround this as requirejs doesnt support optional dependencies. I think between several ways to do that:
Probably I will go with 1st as it defines all the dependencies in one place. But I will need to change some logic inside the available touch libraries handling for that.
If you only want to use Hammer as your touch lib I can make a quick fix for you, that will simplify code and just add hammer as 3rd dependency. So if htats the case I will issue a quick fix.
Well, If it's not going to disturb you, this quick fix to use only Hammer would be awesome! The application where I'm using your extension only needs, in that case, to process the touches and the holds. I really don't need more than one touch lib.
Thank you very much for all this attention, Yaroslav!
Your welcome, Fred! I`ll make a fix today and update you here.
Thanks for using knockouch!
Heres a dirty patch: http://jsfiddle.net/yaroslavya/3s4Xx/1/ Let me know if it will work for you. The dirtiness is that it can be optimized for Hammer usage only. I will release a Hammer only version this weekend, that will have less code.
It worked flawlessly for me! Thank you very much, Yaroslav! Tell me if you make the Hammer optimzed version, it'll be awesome! ;)
I'm trying to import knockouch over requireJS with knockout configred as dependency through shim, but it always returns "ko is not defined".