Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
0 votes
0 answers
84 views

I'm currently working on a project where I have a lot of files like that, exporting functions like this: // file: myFunctions.ts // Function 1 export function add(a: number, b: number): number { ...
Small C's user avatar
0 votes
0 answers
132 views

Does any one know how to put Javascript with namespace in R Shiny? I create a Shiny module to add draggable text to Sankey plot, right click at the text will give an option to remove it from the plot. ...
Juanyao Huang's user avatar
1 vote
0 answers
61 views

I want to include jquery and jquery UI along with requirejs( at top of the header ). with WordPress starting to utillize dynamic module loading and React, primarily in its administrative dashboard and ...
user294095's user avatar
1 vote
2 answers
252 views

I've been migrating an old javascript project to GAS and am hitting a blocker on trying to run namespace functions from the client-side web app. Quick code example: var foo = function() { function ...
Chris's user avatar
  • 23
1 vote
0 answers
33 views

This seems like it should be obvious, but I can not figure out how to properly use namespaced (dotted) function names in jQuery.fn. More precisely, using this in a function embedded in an object ...
danielh's user avatar
  • 41
1 vote
0 answers
4k views

I am trying to export mongoose.Types in two different ways so that I can access it in another file to create interfaces or types. Why does 1 approach work and the other one doesn't? E.g ❌ This doesn't ...
saibbyweb's user avatar
  • 3,304
0 votes
0 answers
618 views

I am working with a third-party library that has a namespace thisLibrary and within that namespace has an interface Options. I would like to add a property to the Options interface and then use the ...
CopyOfA's user avatar
  • 931
3 votes
2 answers
464 views

I realize that namespaces are essentially deprecated in ES6 and don't work well in Visual Code. But I still want to use them. Why? Because I have code spread across multiple files that I want to group ...
Scott Schafer's user avatar
0 votes
1 answer
93 views

Hello> Im creating a Javascript SPA/Rails Api that has books and users. I using namespace in my routes,along with serializers for each model. Im not sure why im getting this error when trying to do ...
GnocchiRose716's user avatar
0 votes
1 answer
2k views

Can I export a namespace A with another namespace B in it? Something like: // b.ts export namespace B { export const val = 'val'; } // a.ts export namespace A { //... some thing import b as ...
Zotille's user avatar
  • 123
0 votes
0 answers
146 views

I do have a span tag that I added a click event to and it gets called twice even though I only click it once and I have no idea why. If I run this code in a separate project then the button only gets ...
Chris's user avatar
  • 3,181
0 votes
2 answers
111 views

I'm trying to access a variable from a namespace on the same page at a "global" level but thus far have been unable to do so. Here's the code: window.addEventListener('resize', () => ...
risingTide's user avatar
  • 1,906
-1 votes
1 answer
318 views

I want to make my code more clear, that the reason i am trying to learn namespaces or nested functions. I've read about them in several places and as i understood 'Revealing Module' is the best option....
Nar Jovan's user avatar
  • 284
0 votes
0 answers
204 views

My project is a microservices project which generates some typescript from .proto files (not relevant). I'd like to create a local npm package that exports what's in these files, in addition to some ...
JonTroncoso's user avatar
44 votes
6 answers
54k views

I have some code like below in my component. <svg id="SvgjsSvg3254" width="318" height="152" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:...
abu abu's user avatar
  • 7,100
2 votes
1 answer
1k views

Update: Question has been solved. Here's the working instantiated code in case anybody needs it for help/reference: https://editor.p5js.org/Rod1C/sketches/iaKn9CKCS I'm new to p5.js and have been ...
Rod1C's user avatar
  • 35
2 votes
0 answers
269 views

After some research on how to write modular/namespace in javascript, I saw that the following might be a good idea on how to encapsulate a function/object: var MODULE = (function (parent) { ...
jack's user avatar
  • 1,411
0 votes
1 answer
319 views

This could be the very basic question of javascript but i am not able to figure out to use the namespance named AudioBridge from the kandy.js file but i dont how should i import the audioBridge ...
Hunt's user avatar
  • 8,435
0 votes
2 answers
909 views

Sorry for the essay, couldn't find a short way to explain this :( Context I am currently building a WebPart for Office 365 which is pretty much like a client side App that users can add to their ...
Union3008's user avatar
-1 votes
1 answer
50 views

I'm building a website using a premium html template, part of the template is in Javascript. So in the template I have something like this - its in the 'master template' every page. //Template JS <...
Ayo Adesina's user avatar
  • 2,465
0 votes
2 answers
4k views

I have a standard web page (not an app rendered with angular, react, vue, etc) that uses jQuery, and other libraries. I want to integrate good practices with TypeScript. What is the best way to do ...
Richard Duerr's user avatar
0 votes
1 answer
135 views

I have some code that I am struggling to understand. I'm no expert in JavaScript (I have a basic grasp), and I've been reading about the DOM and namespacing (and console.log()'ing the variables) to ...
ron_g's user avatar
  • 1,733
0 votes
1 answer
417 views

I have different files with namespace and classes like this: 1) namespace.js: var somenamespace = window.somenamespace || {}; 2) class1.js: somenamespace.class1= (function() { var _public = {}; ...
Jaime Mora's user avatar
0 votes
1 answer
33 views

I'm fairly new to JavaScript though I do have some programming experience with Python. My problem is, that I do not seem understand the concept of namespace in JS since it appears to be different than ...
g_auge19's user avatar
3 votes
1 answer
3k views

TSLint complains that namespaces shouldn't be used and as far as I understand the common sense is that they shouldn't be used anymore as they are special TypeScript construct. So, I have a simple ...
user3612643's user avatar
  • 6,030
0 votes
2 answers
612 views

Is there some way to access the namespace of a script after it is run with $.getScript? Since plugin is defined in the global scope, I would have thought I'd be able to run it. index.js $.getScript('...
abalter's user avatar
  • 10.5k
1 vote
0 answers
45 views

In ES6, I know that you can import named exports like: import { foo } from 'bar' Which is useful in certain module bundlers like Webpack so that it is aware of exactly what is being used in any ...
Matt O'Tousa's user avatar
0 votes
0 answers
215 views

I'm rewriting my JS code to make it more clear and precise. I define one module in namespace and not able to pass the same variable in that bind function, see below code: // Gmap Autocomplete ...
user2809299's user avatar
1 vote
0 answers
215 views

I have polluted one of my classes with too many functions. Now, I want to clean it up by introducing several namespaces. Consider following example: const Tool = {}; tool.fct1 = function() { /* ... ...
Jankapunkt's user avatar
  • 8,471
-1 votes
1 answer
462 views

I am trying to create a namespace that contains all the calls of my application, but I do not know why when I try to do an Ajax call inside the namespace it says that ajax is not a function I Tried ...
Vistor's user avatar
  • 148
1 vote
1 answer
69 views

I am using JetBrain's WebStorm IDE to edit a TypeScript file as part of a Node.js v8.6.0 project. I have the JavaScript version for the project set to JSX Harmony. At the top of the TypeScript ...
Robert Oschler's user avatar
0 votes
2 answers
880 views

How can i use document.querySelector or document.querySelectorAll to get specific tag with any namespace. I cannot use JQuery or any other library. Ex <mml:math> <mml:row> </...
Pavan Tiwari's user avatar
  • 3,217
1 vote
3 answers
650 views

I've recently come across JavaScript Namespaces and how you can use them to create namespaces like other popular OOP languages. I have confusion on how they are declared. For example, var myNamespace ...
Jimenemex's user avatar
  • 3,186
0 votes
2 answers
2k views

I want to write a middleware for the namespace in typescript. So when any function in the namespace is called, middleware should trigger and check if the intended function can be executed. Example: ...
Vinod Kolla's user avatar
0 votes
1 answer
970 views

I need some help with my javascript code. I just recently started using namespaces and I have a problem which I am not able to solve. I have two files data.js and themes.js with a namespace on each ...
liakos lakamas's user avatar
1 vote
0 answers
188 views

File1.ts namespace ServiceUrls { export class ServiceUrls { static baseUrl: string = 'http://localhost:52949/V1/'; static baseImageUrl: string = 'http://localhost:52949/'; ...
Priyanka Pyati's user avatar
0 votes
1 answer
213 views

I have library code does a simple function assignment. This function is accessed from the global scope. When I add "use strict" at the beginning of the file, I get an error TypeError: a is undefined, ...
user694733's user avatar
  • 16.3k
0 votes
1 answer
96 views

I'm trying to detect with jQuery's on only events that are not namespaced. I tried checking the namespace within the callback of on as follows, but it's always undefined: $(".selector").on( "...
Randy's user avatar
  • 23
-1 votes
1 answer
87 views

I am programming using namespaces, and so far I have only used variables and functions inside it. I tried to do a nested object in it, but it doesn't seem to work like I expect it. Here's the code ...
Sartheris Stormhammer's user avatar
0 votes
1 answer
3k views

I have an app running on Backbone in front-end and when a browser loads a page it returns an error in the console: Uncaught ReferenceError: app is not defined at index.js:6 at index.js:51 (...
ASem's user avatar
  • 142
2 votes
2 answers
4k views

I'm having an issue in understanding how to make two files with the same namespace and import one into the other in Typescript. This is the situation: file1.ts export namespace nspace { export ...
valepu's user avatar
  • 3,355
0 votes
1 answer
18 views

For namespaced js modules are non-namespaced file names normally used? C# class filenames, for example, usually reflect only the basic class name as opposed to the fully namespaced class name. So, ...
user7242966's user avatar
0 votes
1 answer
71 views

I wonder, are the following code example the same? Version 1: var myNamespace = {}; myNamespace.say = function() {...} Version 2 (JS-Fiddle: https://jsfiddle.net/542wbkat/) : var myNamespace = new ...
FabianTe's user avatar
  • 659
-1 votes
2 answers
48 views

I have 2 external JavaScript files, one is set up like a "namespace", and the other file calls it. Here is how my "namespace" looks like var GlobalScript = { GetAllStates: function () { $...
Chris's user avatar
  • 3,181
0 votes
0 answers
277 views

I have a very basic and simple question. I am using the pattern as below for declaring namespace: $.Test= { CheckIfListExist: function () { //Something is happening here }, ...
Sree Kuttan's user avatar
0 votes
2 answers
363 views

I'm using IntelliJ IDEA's File Watcher to automatically compile the TypeScript files, but for some reason it's not liking classes defined within blocks / function closures: Is there a way around this ...
chamberlainpi's user avatar
2 votes
2 answers
851 views

In the tutorial mentioned here, the namespace provided by the module is: goog.provide('tutorial.notepad.Note'); But I am wondering why not this: goog.provide('tutorial.notepad'); Since, according ...
CodeYogi's user avatar
  • 1,422
0 votes
1 answer
374 views

I'm reading an article about IIFEs but feel that the main value it brings is that it creates privacies for variables in the sense that in the below code, "i" can't be changed if placed in an IIFE. But ...
akantoword's user avatar
  • 3,114
0 votes
1 answer
283 views

I am new to IIFE and trying to implement namespace in JavaScript on a Siungleton JavaScript class: I have a JavaScript class (say main class): var myIIFE = (function () { var x = null; //...
Veer Shrivastav's user avatar
0 votes
1 answer
132 views

I have been working on web applications for very long time. Worked with most experienced technical architects. Everywhere I used javascript in object notation with namespaces. var web = {}; web.app =...
Fayaz's user avatar
  • 5