I need some guidance how to proceed the best way. Switching from c++ to canjs comes with a steep learning curve
What I’d like to do:
I have my data model structure figured out and want to reuse it in different screens of my application. For each screen I want to have a separate html,css and js file to make sure I don’t create memory leaks etc. Have to figure that out later if really necessary to have all screens in one file.
Now in c++ I would simply put in an include statement for my .h file. Not existing in js and nodejs to my knowledge.
So I dug through the docs and came up with two possible solutions.
a) create my own nodejs-module (how do I do this when I need canMap and canList available)
b) Create a separate can.component which I can reuse (found this in the docs for canjs 2.3 though, so is this still valid?)
Do you know of a third and maybe better solution? If not, which route should I take.
yes I looked into all three tutorials. They were my starting point. Thanks for that
I try to make the question clearer by changing slightly the scope.
Assume I have a data structure defined
var myStructure = can.DefineMap.extend({…});
Now I have two different applications http://myapp1.myUrl.com http://myapp2.myUrl.com
Different layout, functions etc but at some point both relying on myStructure.
In addition, each application consist of one html, js and css file.
Of course I could now copy the definition of myStructure into both js files but this would mean in case of a change I have to update both files. It would be much easier if I could just store the datastructure in http://myUrl.com/datastructure.js and have it loaded by the js file of each application.