The Revealing Module Pattern is an updated Module Pattern where you define all of your functions and variables in the private scope and return an anonymous object at the end of the module along with pointers to both the private variables and functions you wish to reveal as public.
Questions tagged [revealing-module-pattern]
179 questions
0
votes
1 answer
What is proper casing convention for revealing module panel (javascript)
what is the correct starting case for functions and properties when using the revealing module pattern? I have it shown here with lower case for function and uppercase for properties but that does not feel correct.
return {
getRecords:…

Peter Kellner
- 14,748
- 25
- 102
- 188
0
votes
1 answer
JavaScript inheritance with Require.js and the Revealing Module Pattern
Question:
A seemingly simple question that I've been researching on and off the for past 2 weeks (please go easy as I'm new to all this!):
How does one neatly implement inheritance in JavaScript when using Require.js and the Revealing Module…
user993683
0
votes
1 answer
Private members in the revealing module pattern
var app = (function(){
var foo = 'x';
var bar = function (){
...
};
var xx = function () {
bar();
}
return {
xx:xx
}
})();
since the function is a Immediately-Invoked Function Expression…

jinek
- 3
- 2
0
votes
1 answer
Javascript module pattern - Object.create
A bit of confusion regarding what exactly is going on here.
given this simple code :
stuff = (function(){
function extendFoo(bar)
{
$.extend(this.foo,bar);
}
this.foo = {};
return { foo : foo, extendFoo:…

Patrick
- 3,289
- 2
- 18
- 31
0
votes
1 answer
How should I be using the revealing module pattern in JS, passing in references, and avoiding load order issues?
I've been experiementing with the (what i understand to be) the module pattern (or revealing module pattern) in Javascript. At the moment my main objective has been code organisation and cleaning up the global space in my projects but I'm sure there…

bigmadwolf
- 3,419
- 3
- 30
- 44
0
votes
1 answer
javascript revealing module pattern ignored on server
I've been looking for answers why my javascript code is totally on my webhost. I have existing javascript functions that used to work fine until I tried to modify them using the revealing module pattern in javascript because from what I gathered…

smundoKo2
- 3
- 1
0
votes
2 answers
Trouble with removeEventListener in revealing module structure
I'm extremely frustrated with this problem I'm having. I've put together a click/drag code, where when you click on a certain DOM element, it drags the specified DOM element on mouse move, then releases the elements on mouse up.
The problem I'm…

Mike Reed
- 74
- 7
0
votes
3 answers
Slight variation of the Revealing Module Pattern
Is it good practice to use, instead of this Revealing Module Pattern ...
var MyModule = ( function() {
function Method1() { alert( 'method1' ); }
function Method2() { Method1(); alert( 'method2' ); }
function Method3() { Method1(); alert(…

Basj
- 41,386
- 99
- 383
- 673
0
votes
2 answers
Unable to return an object from a .fail() callback?
I am trying to return an object through the _fail callback (Yes, this is meant to run the fail callback), but failSeries is returning as undefined in the console. Any ideas?
var ChartModule = (function ( $, HC, HA, window, undefined) {
//Define…

Tomuke
- 869
- 2
- 8
- 26
0
votes
1 answer
How can I access the public methods on a module from a private?
I have this really annoying problem. I need to able to access the public module function from within a private module pattern. I have written a comment on the problematic line...is there any way to do this?
angular.module("myApp").factory('models',…

Exitos
- 29,230
- 38
- 123
- 178
0
votes
1 answer
revealing module pattern java script cannot access variable
I am implementing the Revealing Module pattern in JavaScript and having difficulty in accessing the declared variable in another script. Below is my code.
Script1:
var SomeEventHandler = (function (){
var logSomeEvent = function(){...}
…

Mandar
- 498
- 1
- 4
- 17
0
votes
1 answer
A correct pattern to use with angularjs
I'm using the following angularjs project structure:
index.html
js/
-- angularjs
-- application.js
-- shared
-----SharedModule.js
-----LocalizeService.js
-----OtherSharedService.js
--…

Andreas
- 405
- 2
- 6
- 14
0
votes
1 answer
"this" in an array of Revealing Prototype Pattern
OK guys - been banging my head on this one. I feel this is a "pointer" issue while using an array of classes built from the Revealing Prototype Pattern. Also, I'm using knockoutjs for my binding.
Issue: I commonly have very involved pages on my…

Jeff
- 865
- 1
- 7
- 7
0
votes
1 answer
View Model Function binding not detected in IE9 but works in FF and Chrome
Update
I realize this question is difficult to follow given the implementation. To see and test a working sample please download the solution.
To test you must use IE9 and the development tools cannot be open. Opening the dev tools will cause the…

rlcrews
- 3,482
- 19
- 66
- 116
0
votes
1 answer
JS Revealing module Pattern, What Am I doing Wrong
I've been trying to utilise the revealing module pattern, and thought I'd make a function for a non-css3 custom scroll bar.
var sb=(function($){
//Private
var settings=function(props){
return{
wrapper: props.wrapper ?…

Luke Madhanga
- 6,871
- 2
- 43
- 47