Questions tagged [revealing-module-pattern]

This pattern is like the module pattern; it focuses on public & private methods. The difference is that the revealing module pattern was engineered as a way to ensure that all methods and variables are kept private until they are explicitly exposed; usually through an object literal returned by the closure in which it’s defined. It also allows the developer to avoid a lot of `this.` in the code.

Filter by
Sorted by
Tagged with
2
votes
0answers
27 views

The modularization of the Express entry point

I've been working on a project to make myself more comfortable with NodeJS, especially Express and TypeScript. Searching and reviewing a lot of approaches of the people, providing bootstraps for it, I ...
3
votes
1answer
57 views

Move and resize square boxes with Vanilla JS

Feature requirements. I can move a square box. I can resize a square box by stretching four edges. Many square boxes can exist. I've implemented moving and resizing square boxes by module pattern. ...
0
votes
1answer
159 views

Revealing module pattern modified for more class-like behavior

I've recently been learning about the revealing module pattern, and it seems like a really good way to structure code in many cases. However, I find myself wanting to use it like a class, so I'm ...
0
votes
1answer
49 views

Javascript 5 Module Pattern internal name

I'm learning about the Javascript module pattern from an array of online sources. The following suits my basic needs at the moment: ...
3
votes
1answer
129 views

Abstraction of google analytics with click events and forms submission handling

I'm keen to get some feedback on how I have utilized the Revealing Module pattern here. This code is part of a web application that is used by the public. The purpose of this code is to encapsulate ...
3
votes
1answer
163 views

Reusable carousel slider component using the revealing module pattern

I want to understand better how to make re-usable components that I can create multiple instances of, and I think the revealing module pattern comes handy, however, I'm not sure I'm implementing it ...
2
votes
0answers
59 views

JavaScript popup component with state depending on existing class

Making long story short, I got a chance to jump from DevOps to Software Development (Frontend). Because I'm quite new to JS design patterns, I need some quality advice about the job I've done recently....
2
votes
1answer
82 views

Javascript module for sorting and searching

Here is a vanilla JS module that I wrote for sorting and searching an array. I would appreciate feedback on the design of the module as I'm new to writing javascript in modules and don't know if I'm ...
4
votes
1answer
501 views

Module with helper functions to initialize or reinitialize a Slick carousel

I been getting into javascript patterns and would love to get some feedback. I notice that I got some general helper functions. Is this a good approach of dealing with it? ...
2
votes
1answer
52 views

Clipboard support in jQuery using revealing module pattern

I have recently been getting into the habit of leveraging the revealing module pattern for all my code. I used this guide for inspiration, but my code doesn't feel as elegant. ...
2
votes
0answers
142 views

Google Maps API implementation with a revealing module pattern

What follows is the JavaScript written for a Google Maps API implementation (for an image gallery that shows image, location, description, next and prev buttons, etc.). I have a JSON ...
1
vote
1answer
75 views

Countdown module that hides an element when a specified date is reached

I have the following piece of code which hides an element when a specified date was reached. I would like to get some tips about do's and don'ts. Specifically, I'm interested in: improvements ...
3
votes
1answer
98 views

Rock, Paper, Scissors, and the Revealing Module Pattern

After reviewing this approach: Rock-Paper-Scissors with the revealing module pattern I decided to write an alternative where the Revealing Module Pattern is used for the UI, model, and controller. I ...
5
votes
1answer
211 views

Rock-Paper-Scissors with the revealing module pattern

In my ongoing effort in learning advanced JavaScript I tried to develop the traditional rock paper scissors game by using the famous revealing module pattern. I'm not comfortable yet with what has to ...
3
votes
0answers
80 views

Mini school database with JS revealing module pattern

I tried the module pattern for the first time, with this exercise as a problem to solve: http://exercism.io/exercises/javascript/grade-school/readme It's a small exercise requiring simple tasks : ...
3
votes
1answer
77 views

Stock performance app

I'm building an app that tells you a stock's percentage change in price between two dates by using Yahoo's API. Given a stock ticker and two dates, it currently outputs the percentage return to the ...
2
votes
0answers
108 views

Weather Application - Reavling Module Pattern

I'm trying to practice and learn design patterns, and I decided to create a weather app using the revealing module pattern. How can I improve on this, and what mistakes did I make? Main.js ...
2
votes
2answers
113 views

Should I use module pattern for this notification controller?

I have the following code, I use this pattern for the entire JavaScript code. I'm trying to re-factor my code again. Should I use the Module pattern? Revealing Module Pattern to be specific? What's ...
20
votes
1answer
386 views

Alea implementation

The following is an implementation of the Alea random number generation approach by Johannes Baagøe, reworked from the rot.js implementation by dropping all the pesky underscore prefixes in the ...
10
votes
1answer
2k views

Node module using promises and the revealing module pattern

Can someone give me some feedback on this pattern? I am writing a node.js module that connects to a remote API, caches JSON, returns it as output. I have a cli wrapper script that uses the module, ...
1
vote
0answers
52 views

Injecting required functions by synchronous script loading

I have a file HintBox.js containing a JS prototype of the same name which requires our internal JS library (call it $lib) in ...
2
votes
1answer
737 views

Module pattern callback implementation

I'm rewriting a simple app using HTML/CSS/JavaScript that creates animations with images using intervals, and there's a bunch of buttons that controls these animations. It's scaling and becoming ...
2
votes
1answer
208 views

Am I using the JavaScript “module pattern” correctly?

I am reading this article about how you can organize JavaScript code for large projects. I am attempting to write a simple events calendar as a way to play with some of these design patterns. Using ...
7
votes
1answer
510 views

First “Revealing Module” implementation

I have a little js I call a "jqGrid Factory" to encapsulate common settings and functionality across my web app. I just want to see what improvements I can make. ...
0
votes
1answer
53 views

Singleton model for modifying future .chart elements

I have written a singleton module which is to be used for some future modifications on .chart elements. Modification functions, such as ...
4
votes
3answers
480 views

Extracting pattern and simplifying testing

I observe the same pattern in a number of my classes but can't extract/abstract it due the tight coupling inside each particular implementation. Having the class accepting an optional number of ...
4
votes
1answer
1k views

Revealing module implicity calling an internal function - is this a “smell” [closed]

I'm trying to improve my javascript and have been using the revealing module pattern to good effect but I noticed that code in the module not in a function or the return is executed on creation have ...