Comments (3)
from slicerappstore.
To answer your question, yes, this is a commonly used way to pass such data. The javascript is written separately from the views, and we do not populate any of our javascript from the controllers. The controllers can only pass data to the views, therefore we have to go through the view to pass data to our javascript. This is a good thing: it makes our javascript code static so that browsers can cache it; only the view code has to be dynamic. An alternative might be to never pass json through the view, but to force every view (via js) to re-request the server to get its json, but this would that would be expensive, redundant, and break atomicity. Either way, we have to get a serialized json object and then parse it into a hierarchy, so we might as well do it via the same request. Storing it inside a DOM element is just a mechanism for naming the data essentially.
The data() function of jQuery is used to store arbitrary data on DOM nodes. We use it in many places, but it is unrelated to the problem of passing data from the view into our javascript context, since you can only use it if you already have the data in your javascript context. If you have that, then the problem is already solved :)
You're right, we should probably namespace both the div and the globally scoped variable that we use to store our passed json. ("#midasJsonContent" and "var midas.json").
from slicerappstore.
Note that renaming json to midas.json would be another significant javascript refactor, as we reference it in many many scripts in core as well as modules.
from slicerappstore.
Related Issues (20)
- Extension overview - Os / Arch should be used in a generic way HOT 1
- Passing revision/os/arch params to index controller doesn't work HOT 2
- slicerView param should be renamed into something generic integrated to Core HOT 1
- Extension comment - next|prev link left aligned + visible only when required HOT 1
- Mechanism allowing user to login / register from within the embedded view HOT 7
- Js function to switch between Download/Installed button HOT 1
- Embedded page - Prevent page from reloading when cliking on "Install" HOT 1
- Error happening when appending the 'slicerView' param to Url
- ExtensionList page should list most recent extension HOT 11
- Empty layout doesn't work if 'CSS and Javascript optimizer' is enabled HOT 1
- Extension thumbnail have the wrong aspect ratio HOT 3
- Add Links section HOT 1
- Hide tutorials if no value
- Number of extension near category HOT 2
- Lightbox should limit display size to the screen size so you don't have to scroll
- Improve breadcrumb view styling
- Screenshot are displayed in full size - would it be possible to limit the height HOT 9
- In web view, wrong count per category after entering a revision
- Update URL with os, revision and arch HOT 4
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 slicerappstore.