samduvall / backbone-relationships Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hey Sam,
I was trying out your library today and found the codec idea to be pretty great. Unfortunately when I set up a quick example, my codecs weren't affecting my model fields at all. After further inspection of the code it appeared that the format of the "fields" object in your examples is possibly out of date? Or maybe I somehow have an older version of your code. Correct me if I'm wrong but in your examples fields is an array that looks like this:
fields: [
{name: 'exampleField', codec: Date}
]
But it should be this:
fields: {
example: {type: Date}
}
After changing my format to the latter, my codecs started working.
On another note, when importing your library using require, it does not work. The issue is that the your index.js which is used as the entry point when the library is required, builds up the library in a way in which each piece (Relation.js, Model.js, has-one.js, etc) are not aware of eachother or some of their needed dependencies and the browser now throws an error that the HasOne object cannot be found. I fixed this by changing the using the fully built backbone-relationships.js file as my index.js and it now works as expected. Note: This issue shows up when you try to use npm's "Try it out" functionality on npmjs.com.
Hope this helps! Love the library now that I have it working.
Dock
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.