Comments (8)
Just a quick note on your first point, as I think it's not mentioned in the docs:
You can already disable injection for specific resources like this: https://github.com/moschlar/SAUCE/blob/develop/sauce/lib/base.py#L42
It's "documented" in the source as a parameter https://github.com/toscawidgets/tw2.core/blob/develop/tw2/core/resources.py#L116 and in the WidgetBrowser, too: http://tw2-demos.threebean.org/module?module=tw2.core#JSLink (Parameters)
from tw2.core.
Yep, disabling resources injection is an option that can sometime solve dependencies collision like for different versions of jQuery by making possible to add them by hand to your master template. Still it doesn't solve at all the issue with ajax loading of widgets and resources tracking between different requests.
from tw2.core.
I made an experiment at using a javascript loader with module collision detection to load widgets resources. The result is really satisfying, a sample of widgets using that paradigm can be found at https://bitbucket.org/axant/axf
Resources loading is provided using the AxelWidgetMixin, which provides resources loading through the AXEL loader https://bitbucket.org/axant/axf/src/6e55b327694237250a85bc644ddabcb6ff04fb7a/axf/axel.py?at=default#cl-86
This seems to solve quite well the issue with resources collision, loading resources between requests and loading resources in a widget loaded through ajax.
from tw2.core.
@ralphbean just mentioned http://www.fanstatic.org/en/latest/intro.html in the IRC.
from tw2.core.
Any thoughts on how to best integrate this with the core? I like the idea (we even implemented our own poor attempt at this years ago in Moksha). I'm just afraid of bloat in tw2.core at this point.
If it could be done in a small amount of code (which I think it can be -- we just modify our resource injector to inject AXEL statements instead of <script>
tags) and if it can be turned off by default, saving legacy users from having to adapt to AXEL it could be a win.
Any reason to not go with require.js? I've not used it. Why axel?
from tw2.core.
@ralphbean requires.js is a good match, but has two side effect. First of all you need to edit your libraries to declare them all as modules, so you cannot take a library as is and use it. The other issue is that it doesn't support CSS loading.
AXEL was created to address both issues, but as I recognize that every user has his own favorite loader (and to make client side resources resolution work you need to use the loader for your own app) I think that the best way would be to provide an interface and let people provide the actual commands to load the resource. Maybe we can even provide two or three builtin examples for most common loaders.
from tw2.core.
👍 - If anyone has the time/energy/desire to implement this, please do so and submit a pull request.
I'm going to spend my time cleaning and fixing any bugs introduced in #78 before getting into this one. Once that's done I'll pick it up (if no one else has yet).
from tw2.core.
I created an experimental tw2.asyncresources package that aims at solving this issue.
It provides support for multiple JS loaders and permits to add more, I'm not sure that it is the best way to achieve this, but it works also for already existing widgets implemented by third parties.
https://github.com/amol-/tw2.asyncresources
It would be great if anyone can provide feedbacks on the proposed implementation, keep in mind that the provided Calendar example only works if tw2.forms@develop is used, as previous versions wrote the javascript directly inside the widget template instead of using add_call.
from tw2.core.
Related Issues (20)
- All and Any validators don't work with unicode strings
- Inheritence as explained in the Design Document does not work
- The function _opt_matches_ value does not work correctly in forms.MultiSelectionField with formencode.validators.int HOT 3
- archive_tw2_resources not working with TurboGears==2.3.1 and tw2.core==2.2.1 HOT 4
- Add title attribute to HTML5PatternMixin widget HOT 1
- Expose test dependencies as extras
- TODO: Test suite for archive_tw2_resources
- tw2 core MatchValidator bug in _is_empty method HOT 1
- Proposal for updated MatchValidator HOT 1
- FormPage documentation errors? HOT 1
- Autoreload Templates not working anymore
- Widgets can't act as Controllers HOT 1
- Make "reserved_names" a base widget property so it can be overridden
- python 3 and toscawidgets setup.py
- ToscaWidgets Wikipedia Page
- Widget value type consistency issue, list/dict vs orm/relations HOT 1
- kajiki import path
- coexistence with tw1
- Widget Browser is down
- Syntax error warning in tw2/core/resources.py HOT 2
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 tw2.core.