Reputation: 45
I'm searching for a way to use Parse JS SDK with Durandal. As Parse JS SDK is a Backbone module it seems to it should be somehow modified. I'm not familiar with Backbone and I can't find a guide which can help me with it. I want to use Parse Java Script SDK as common Durandal (more precisely require.js) module as following:
define(['knockout', 'gmaps', 'durandal/composition'], function (ko, gmaps, composition) {
...
var latLng = new gmaps.LatLng(blah blah);
...
I'm trying to use Parse SDK similarity but have no luck there:
define(['parse'], function(parse) {
console.log('Parse: ' + parse); //undefined
I added a path to it in my config:
requirejs.config({
paths: {
'text': '../lib/require/text',
'async': '../lib/require/plugins/async',
'propertyParser': '../lib/require/plugins/propertyParser',
'goog': '../lib/require/plugins/goog',
'durandal': '../lib/durandal/js',
'plugins': '../lib/durandal/js/plugins',
'transitions': '../lib/durandal/js/transitions',
'bootstrap': '../lib/bootstrap/js/bootstrap',
'knockout': '../lib/knockout/knockout-2.3.0',
'parse': '../lib/parse/parse'
}
});
Inside the SDK module there are really lot of code and I can't understand how it should be modified for further Durandal use. Someone could explain this?
P.S. I see that using the Parse JavaScript SDK is comfortable way to work with Parse BaaS, but if this SDK cannot be converted for my purposes, would not it be too hard to use Parse with pure JS ? I mean without SDK.
Thanks!
Upvotes: 0
Views: 159
Reputation: 2603
Your config seems ok, thou maybe the shim is missing. A quick search via google brought up this projects main.js config.
Here is the shim part:
parse: {
deps: ['jquery', 'underscore'],
exports: 'parse'
}
Hope this helps in any way
EDIT: As mentioned in the comments it may be that Parse.com isn't AMD conform. Having googled a bit I found a (github project)[https://github.com/guillegette/amd-parse] which makes it AMD-conform. Guess this will help you out.
Upvotes: 1