草庐IT

publicAlert

全部标签

javascript - 使用 javascript 模块模式时如何从私有(private)方法中调用公共(public)方法?

我想从私有(private)方法调用公共(public)方法,但属性“this”指的是窗口对象。请注意我正在尝试应用模块模式。您可以在jsfiddle.net找到工作代码示例//howcaniaccessapublicmethodfromaprivateone?//(inthisexamplepublicAlertfromprivateMethod)//thisreferstothewindowobject.$(function(){varmodulePattern=(function($){varprivateMethod=function(){appendText("calledp