javascript - Parse.View.extend - "cannot read property 'extend' of undefined" -


currently using parse javascript sdk web app, i'm new backbone, , since particular problem in functionality parse copied on backbone, i'm not sure i'm making mistake.

i have index.html, basic structure & script template tag (to used _underscore):

<div id="my-app">          </div> <script type="text/template" id="album-header-template">     <div id="some-id">           content     </div> </script> 

at end of <body>, following script tags, take care of parse dependencies, load parse, & use own js file:

<script src="libraries/node_modules/jquery/dist/jquery.min.js"></script> <script src="libraries/node_modules/underscore/underscore-min.js"></script> <script src="libraries/node_modules/parse/dist/parse-latest.min.js"></script> <script src="app/parseapp.js"></script> 

then in parseapp.js, trying off ground creating simple objects , views, have following:

$(function () {     var album = parse.object.extend("album",{             // default attributes album             defaults: {               name: "album title"             },              // ensure each album created has title             initialize: function() {               if (!this.get("name")) {                 this.set({"name": this.defaults.content});               }             },         });      var homeview = parse.view.extend({         el: $("#my-app"),          initialize: function() {             console.log("new instance of homeview");             this.render();         },          render: function() {             this.$el.html(_.template($("#album-header-template").html()));         }     });      new homeview; }); 

when run index.html in browser, following error in console: uncaught typeerror: cannot read property 'extend' of undefined (occurring @ var home view = parse.view.extend line).

originally, had thought might because parse wasn't initiated in time parseapp.js use it, based on scripts loading. however, ran recommended "test sdk" script parse, , it's indeed initialized (in addition, adding object var album works fine). i'm stuck on what's causing either homeview or parse.view "undefined".

likely straightforward answer i'm overlooking, appreciated, , provide full files if need be.

not satisfying answer, @yura & @daniel blank, discovered error resulting because recent versions of parse sdk (everything after 1.6.0) no longer include full backbone functionality. includes version had been using locally npm.

the best explanation of parse sdk direction in link given above, , there seem 3 options, hoping continue using parse and/or backbone:

  1. use old version (1.5.0 being recent includes backbone functionality) in order maintain backbone functions, such parse.collection or parse.router.
  2. try going parse sdk-agnostic, while continuing use backbone. can use basic parse rest api, or try 1 of the github projects attempting linking you.
  3. give on backbone going forward, , use parse vanillajs, or perhaps switch on react (which direction facebook want parse head)

i'm inexperienced recommend 1 of three, although #1 seems easiest, while #3 seems far , away maintainable. still trying make own decision, that's outside scope of original question. help, everyone.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -