Issues with implementing Bootstrap datetimepicker in ClojureScript

Recently, I encountered an issue while attempting to integrate Bootstrap datetimepicker into my clojurescript project. Here's the snippet of code I used:

(.datetimepicker (js/$ "#dateid")

Unfortunately, I kept running into a frustrating Uncaught TypeError related to the datetimepicker function.

Error: Uncaught TypeError: $(...).Bk is not a function

After some investigation, it seems that the culprit behind this error might be the aggressive optimization carried out by the Google Closure Compiler. To potentially solve this, one workaround involves creating an extern.js file and specifying the function names to prevent them from being overly optimized by the closure compiler.

Despite my efforts to tweak the extern.js file as suggested, the issue persists. My current extern.js file contains the following declarations:

 var $ = function (arg1, arg2) {};
    $.prototype.val = function(arg1) {};
    var selectpicker = function() {};
    $.datetimepicker = function(arg1) {};
    var datetimepicker = function() {};             

Even after making these adjustments, the same error keeps popping up. I'm at a loss and in need of guidance on correcting the extern.js configuration to prevent the bootstrap-datetimepicker functions from being excessively optimized and causing Unknown Type exceptions.

Answer №1

When utilizing the Google closure compiler to compile ClojureScript's JavaScript files into an optimized file, it can lead to issues when attempting to integrate with JavaScript libraries without using externs to map names. For example, the function name Bk may be optimized but should ideally be mapped using an externs.js file. However, the exact process of how to achieve this remains unclear to me.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

AngularJS - Swipe to update

I've been trying to use the pull to refresh plugin for Angular JS, but unfortunately it's not working for me. Even though I can see the text, when I try to pull nothing happens! I followed all the steps outlined on this GitHub page: https://githu ...

Eliminate the CSS triggered by a mouse click

Having some difficulty toggling the switch to change the background color. Struggling with removing the applied CSS and getting it to toggle between two different colored backgrounds. Code Sample: <!Doctype html> <html lang="en"> <head> ...

Display or conceal a YouTube video with a click

Q1) Is it possible to use JQuery on page load to detect the file name of an image and then dynamically position it on the page with CSS? Q2) What is the most efficient way to achieve this without embedding iframe code inside a specific div.icon element? ...

Displaying random characters in place of Angular 6 font awesome icons

Recently, I started a new project with the angular cli and incorporated font-awesome 4.7.0. After that, I included it as a dependency in my angular.json file. "styles": [ "./node_modules/font-awesome/css/font-awesome.min.css", "./node ...

Learn the process of adding values to HTML forms within ExpressJS

I am facing a challenge in injecting Javascript variable values into HTML forms on an Expression JS server. I am unsure about how to solve this issue. All I want to do is insert the values of x, y, and res into the forms with the IDs 'firstvalue&apos ...

How jQuery stops the submission of a form

Sample HTML Code <p><select name="status" class="form-control" id="showThisItem"> <option value=""> Select Status </option> <option value="Paid"> Paid </option> <option value="Unpa ...

What is the process of importing an npm module into an Angular application?

While searching for a solution, I stumbled upon this npm package that allows us to group arrays according to our needs. I want to integrate this package into my Angular application for grouping arrays. What is the correct way to import this package into ...

Learn how to effectively share an image using the Math.random function

Is there a way to display a random number of images on a webpage using JavaScript? Let's say we want to show X number of images, where X is a randomly generated number. For the sake of this example, let's set X to be 10. <input class="randomb ...

Obtain the name of the client's computer within a web-based application

I am working on a Java web application that requires the computer name of clients connecting to it. Initially, I attempted to retrieve this information using JavaScript and store it in a hidden form field. However, I discovered that JavaScript does not hav ...

What is the best way to divide a GraphQL schema to avoid circular dependencies?

I have a question that is similar to the issue of circular dependency in GraphQL code discussed on Stack Overflow, but my problem lies within JavaScript (ES6). The size of my schema definition has become too large, and I am struggling to find a way to bre ...

Error encountered while executing ExpressJs function that was converted to a promise

Understanding how errors are handled in promises can be a bit tricky, especially for someone new to promises like myself. I'm trying to make the most of them, but I'm not quite there yet. Here is the code snippet I'm working with: app.list ...

Using jQuery to handle multiple AJAX XML requests

Currently, I am working on developing a JavaScript XML parser using jQuery. The idea is that the parser will receive an XML file containing information along with multiple links to other XML files. As the parser runs, it will identify tags within the file ...

A guide on how to select all child checkboxes when the main checkbox is checked in a React application

I am looking to achieve a dynamic check of the children's checkboxes when the main checkbox is checked, specifically using ReactJS. I have come across solutions on Stackoverflow that involve JQuery, but I want to implement this functionality in ReactJ ...

Using Regex to detect recurrent (similar) patterns in jQuery <input> tags

I need assistance with ensuring that users input article numbers in the correct format, like this: ABC_ABC123; AB__B2A4; ABF_323WET; ... Currently, I have a regex pattern that works for one article number: var mask1 = /^([A-Z]{2})([A-Z|_]{1})_([A-Z0-9]{ ...

Top-rated online SVG What You See Is What You Get editor

Looking for a drawing program for my website where users can create floor plans and insert text into the images. Does anyone know of a good SVG WYSIWYG editor that can do the job? Otherwise, I might have to resort to using a Flash or Java app, which I&apos ...

JavaScript code to enforce a 100% page zoom setting

After developing a small game in Canvas, I encountered an issue. Some users with their default zoom level set to something other than 100% are unable to view the entire game page. I attempted to resolve this by using the following CSS: zoom: 100%; This ...

There seems to be an issue with this webpage - localhost has failed to transmit any data

I am currently experiencing an issue where, upon clicking on the href links, the page takes a considerable amount of time to redirect. However, instead of successfully redirecting at the end, I receive an error message stating that the page is not working. ...

Best practices for managing CSV files in Next.js with TypeScript

Hello, I am currently working on a web application using nextjs and typescript. One of the features I want to implement is a chart displaying data from a csv file. However, I am not sure if using a csv file is the best choice in the long run. I may end up ...

Modifying CSS files in real-time

I've been attempting to dynamically change the CSS file, but I've run into an issue: Whenever I try to alter the style, it seems to work correctly while in "debug mode", showing that the changes are applied. However, once the JavaScript function ...

Can you explain the contrast between using require('d3') and require('d3-selection')?

While working on a nodejs application with javascript, I encountered an interesting issue. In my code, I am passing a d3 selection to a function as shown below. // mymodule.js exports.myfunc = function(ele){ if(ele instanceof d3.selection){ // do so ...