7 views
Skip to first unread message

Fotis Paraskevopoulos

unread,
Mar 2, 2016, 1:13:15 PM3/2/16
to apostr...@googlegroups.com
Hello Tom,

I am looking at this page for a refresher



This is my module in app.js

’supper-map':{
  extend: 'apostrophe-snippets',
  name: ‘supperMap',
  label: 'Maps',
  instance: ‘supperMap',
  instanceLabel: 'Maps',
  menuName:’superMapMenu’
}

This is my index.js

module.exports = superMap;

function superMap(options, callback) {
  return new superMap.Map(options, callback);
}

superMap.Map = function(options, callback) {
  var self = this;

  module.exports.Super.call(this, options, null);


  if (callback) {
    process.nextTick(function() {
      return callback(null);
    });
  }

};


I get the following error

/usr/src/app/lib/modules/supper-map/index.js:10
  module.exports.Super.call(this, options, null);
                      ^

TypeError: Cannot read property 'call' of undefined



Any ideas?

FP


PS - To be honest I wanted to override the apostrophe-map module, but since I can’t get it to work I fell back to the documentation, and I see that the problem is the same when trying to override a snippet.


Fotis Paraskevopoulos

unread,
Mar 2, 2016, 1:30:45 PM3/2/16
to apostr...@googlegroups.com
Hello Again,

Ok, I figured out that I was not using the “plural” instance name in my factory constructor and this seems to make a difference.

So this works


module.exports = superMaps;

function superMaps(options, callback) {
  return new superMaps.SuperMap(options, callback);
}

superMaps.SuperMap = function(options, callback) {

  var self = this;

  module.exports.Super.call(this, options, null);


  if (callback) {
    process.nextTick(function() {
      return callback(null);
    });
  }

};



Can this be possible?

FP


--
You received this message because you are subscribed to the Google Groups "apostrophenow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apostropheno...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom Boutell

unread,
Mar 2, 2016, 3:30:16 PM3/2/16
to apostr...@googlegroups.com
There's a lot of inconsistency (supper vs. super, singular vs. plural, name and instance the same?) in what you've sent here. I think you have some things to iron out there.
--


THOMAS BOUTELL, DEV & OPS
P'UNK AVENUE | (215) 755-1330  |  punkave.com

Fotis Paraskevopoulos

unread,
Mar 9, 2016, 3:49:18 AM3/9/16
to apostr...@googlegroups.com
Hello Tom,

I really made an effort of forking the boilerplate to replicate the problem. The spellings mistakes you see here is because I didn’t copy paste the code, but rather overrode the names given that my client name was used as a prefix.

Anywho…

For anyone ever stumbling here, the actual problem was the fact ( and I am very ashamed of this ) that I hadn’t installed ‘apostrophe-snippets’. I know … I know…

It is something I noticed I was doing instinctively trying to replicate the error, to show you, and that is how I noticed.

So, make sure you have in your package.json the module you are trying to extend.

Cheers,
FP


Reply all
Reply to author
Forward
0 new messages