I have a web app in which I am using HTML Notifications. It works fine if the user allows it for the first time and start using it, however if user blocks the notification the first time by clicking the block button and later on try to request permission again by some user gesture then the browser doesn’…
Author: admin@master
ECMAScript 6 spread syntax in object deconstruction. Support in TypeScript and Babel
Is the following valid ECMAScript 6? It seems to be supported by the latest version of Babel but it isn’t by TypeScript. I couldn’t find any ES6 references dealing with this case. Answer No, this is not valid ECMAScript 6. ES6 does only support rest syntax in function parameters and array destruct…
Jquery nested LI elements inside tabbed content UL LI list
Im using tabbed content on my page (SEE MY FIDDLE) Now the tabbed content makes use of <ul><li> elements to display the different tabs. Inside one of these tabs I would like to add a <ul><li> list however the list is not getting displayed correctly I suspect because: The jquery is effe…
Methods in ES6 objects: using arrow functions
In ES6, both of these are legal: and, as shorthand: Is it possible to use the new arrow functions as well? In trying something like or I get an error message suggesting that the method does not have access to this. Is this just a syntax issue, or can you not use fat-arrow methods inside of ES6 objects? Answer…
.map() a Javascript ES6 Map?
How would you do this? Instinctively, I want to do: I’ve haven’t gleaned much from the documentation on the new iteration protocol. I am aware of wu.js, but I’m running a Babel project and don’t want to include Traceur, which it seems like it currently depends on. I also am a bit cluel…
Restricting pointermove interactions to two layers in openlayers 3
In openlayers version v3.6 running in Chrome on Ubuntu I have create a map with several layers (foo, bar, beltch) in it using the syntax: I would like to limit interactions to the layers foo and bar The api documents at http://openlayers.org/en/master/apidoc/ol.interaction.Select.html suggest using the follow…
How to show a popup modal in codeIgniter?
I have written a javascript click function to a class to display a popup when the relevant class be clicked. When i just put an alert it gives me the correct output. but the popup modal is doesn’t show up Model I am using following model function And i am calling that method in the following controller …
Selecting and removing a html select option without selecting by index or ID, using vanilla JavaScript
I need to remove an option on a select box, and I’ve figured out a potential solution in the code below, but it doesn’t feel particularly ‘safe’ (if another developer decided to add an option to the backend, the option will re-appear). Is there a better way of achieving this without re…
How to send current page number in Ajax request
I am using jQuery DataTable to display huge amount of data in a table. I am getting data page wise on Ajax request like this: and here is the spring controller: The problem is that when I change page in table it alerts correct pageNo on page (in JavaScript), but in spring controller I am always getting the in…
Convert javascript object camelCase keys to underscore_case
I want to be able to pass any javascript object containing camelCase keys through a method and return an object with underscore_case keys, mapped to the same values. So, I have this: And I want a method to output this: What’s the fastest way to write a method that takes any object with any number of key…