Tag: anonymous types

使用Javascript IFFE获取未捕获的TypeError不是一个函数

我试图在javascript中编写一些匿名函数IFFE的东西,我不明白为什么我得到这个错误 Uncaught TypeError: dM.getResources is not a function 小提琴https://jsfiddle.net/MillerDev/5qmnqr6q/ 是什么造成的? reportGroupDataManager (通常这是reportGroupDataManager.js文件) var reportGroupDataManager = (function() { var self = this; // cannot do this below as dM.getResources is not a function //self.getResources = “blah”; self.getResources = function() { return object; // return ajaxHelper.get(actions.adminReports.getResourceFileUrl, {}); }; console.log(‘reportGroupDataManager’); return self; }); 数据 (目前占位符) function data() { […]