<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>JavaScript on Infinite Script</title><link>https://www.infinitescript.com/tags/javascript/</link><description>Recent content in JavaScript on Infinite Script</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 12 Dec 2016 03:30:53 +0000</lastBuildDate><atom:link href="https://www.infinitescript.com/tags/javascript/index.xml" rel="self" type="application/rss+xml"/><item><title>Create a Desktop App with Angular 2 and Electron</title><link>https://www.infinitescript.com/2016/12/create-a-desktop-app-with-angular-2-and-electron/</link><pubDate>Mon, 12 Dec 2016 03:30:53 +0000</pubDate><guid>https://www.infinitescript.com/2016/12/create-a-desktop-app-with-angular-2-and-electron/</guid><description>&lt;p&gt;Last week, I took part in the Google Developer Day held in Beijing. The Angular team introduced their new Angular 2. Angular is a development platform for building mobile and desktop web applications.&lt;/p&gt;&#10;&lt;p&gt;&#10;&#10;&lt;a href="https://www.infinitescript.com/2016/12/Google-Developer-Day-2016-Beijing.webp" data-fancybox data-caption="Google-Developer-Day-2016-Beijing"&gt;&#10; &lt;img src="https://www.infinitescript.com/2016/12/Google-Developer-Day-2016-Beijing.webp" alt="Google-Developer-Day-2016-Beijing" loading="lazy"&gt;&#10;&lt;/a&gt;&#10;&#10;&#10;&lt;/p&gt;&#10;&lt;p&gt;This tutorial shows how to configure and use Angular 2 web components with the Electron framework for creating native cross-platform applications with web technologies.&lt;/p&gt;&#10;&lt;p&gt;As recommended by the Angular team, TypeScript will be used throughout this tutorial. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open-source.&lt;/p&gt;</description></item><item><title>Use WebSockets with Spring, SockJS and Stomp</title><link>https://www.infinitescript.com/2015/05/use-websockets-with-spring-sockjs-and-stomp/</link><pubDate>Wed, 20 May 2015 14:42:45 +0000</pubDate><guid>https://www.infinitescript.com/2015/05/use-websockets-with-spring-sockjs-and-stomp/</guid><description>&lt;p&gt;This guide walks you through building a &amp;ldquo;hello world&amp;rdquo; application that sends messages back and forth between a browser and the server. WebSocket is a very thin, lightweight layer on top of TCP, which makes it a natural place to run a &lt;em&gt;subprotocol&lt;/em&gt; that gives the raw bytes some structure. Here we use &lt;a href="https://en.wikipedia.org/wiki/Streaming_Text_Oriented_Messaging_Protocol"&gt;STOMP&lt;/a&gt; messaging with Spring to create an interactive web application.&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This post has been &lt;strong&gt;updated for Spring 6/7&lt;/strong&gt;. The WebSocket setup now uses &lt;code&gt;@EnableWebSocketMessageBroker&lt;/code&gt; Java configuration and the modern &lt;code&gt;@stomp/stompjs&lt;/code&gt; client. The original 2015 version targeted Spring 4.1 with XML &lt;code&gt;&amp;lt;websocket:message-broker&amp;gt;&lt;/code&gt; config and the legacy &lt;code&gt;Stomp.over()&lt;/code&gt; API; both are obsolete and have been replaced throughout.&lt;/p&gt;</description></item><item><title>WordPress $ is not defined</title><link>https://www.infinitescript.com/2014/08/wordpress-is-not-defined-even-if-jquery-is-loaded/</link><pubDate>Thu, 21 Aug 2014 04:29:54 +0000</pubDate><guid>https://www.infinitescript.com/2014/08/wordpress-is-not-defined-even-if-jquery-is-loaded/</guid><description>&lt;p&gt;If you copy a normal jQuery snippet into a WordPress theme or plugin, sooner or later you hit &lt;code&gt;Uncaught ReferenceError: $ is not defined&lt;/code&gt;. The confusing part is that jQuery itself &lt;em&gt;is&lt;/em&gt; loaded; your other jQuery code may even be working. So why does &lt;code&gt;$&lt;/code&gt; blow up?&lt;/p&gt;&#10;&lt;h2 id="why-it-happens"&gt;Why It Happens&lt;/h2&gt;&#10;&lt;p&gt;WordPress ships its own copy of jQuery and loads it in &lt;strong&gt;no-conflict mode&lt;/strong&gt;. On startup it effectively runs:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;jQuery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;noConflict&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;noConflict()&lt;/code&gt; tells jQuery to give back control of the global &lt;code&gt;$&lt;/code&gt;. After it runs, &lt;code&gt;jQuery&lt;/code&gt; still points to the library, but &lt;code&gt;$&lt;/code&gt; no longer does; it is left free for some other library to claim.&lt;/p&gt;</description></item><item><title>How does Ajax Work</title><link>https://www.infinitescript.com/2014/06/how-does-ajax-work/</link><pubDate>Thu, 05 Jun 2014 16:24:02 +0000</pubDate><guid>https://www.infinitescript.com/2014/06/how-does-ajax-work/</guid><description>&lt;p&gt;Ajax, a term coined by Jesse James Garrett that became popular after the publication of the article Ajax: &lt;a href="http://web.archive.org/web/20181231094556/https://www.adaptivepath.com/ideas/ajax-new-approach-web-applications/"&gt;A New Approach to Web Applications&lt;/a&gt; in February 2005, is short for Asynchronous JavaScript and XML.&lt;/p&gt;&#10;&lt;p&gt;The normal behavior of the Internet that involves sending pages to the browser is completely changed by the use of Ajax.&lt;/p&gt;&#10;&lt;p&gt;Ajax has become commonplace with its integration in HTML 5 and JavaScript frameworks, and in fact, the interest of developers has moved to HTML 5 for its new tags and APIs that accompany it. Among these, WebSocket appears as the successor to Ajax, because it is a superior means of communication between an application and the server or the backend.&lt;/p&gt;</description></item></channel></rss>