-
AST fun. Remove a function call from your bundle
posted in JavaScript on 2020-01-13 javascript ast bundle object property path callee javascript esprima node const type -
I'm working on a small library that has a logger. I'm bundling the app to a single file and I want to disable the logger for the production version. In this blog post we will see how I removed the
read morelogger.log
calls from my bundle using AST (abstract syntax tree).
-
Make your objects iterable
posted in JavaScript on 2019-11-01 javascript iterator skills console log javascript const lastname object react parts user method -
Just recently I became a fan of the iterable protocol. I knew about it for some time now but never actually integrated it on my own. I ended up using it to provide a nice API for one of my libraries and I thought that this approach worth sharing.
read more
-
Post-transpilation or what is the real face of your code
posted in JavaScript on 2017-10-10 function user return firstname lastname var person object constructor greeting -
If you write JavaScript today you probably use some sort of a transpilation tool. A tool that reads your hipster code and convert it to code that works in the browser. In this article we are going to see what is actually send to the browser and how exactly libraries like Babel polyfill some of the ES6 features.
read more
-
Constructive destructuring
posted in JavaScript on 2016-02-24 var destructuring function object data enabled files options attachments -
Destructuring is one of my favorite ES6(ES2015) features. It just shortens my code and helps me be more explicit with my statements. Let’s see it in action.
read more
-
JavaScript: creating class based on object
posted in JavaScript on 2013-08-31 object function var return ob2 ob1 create obj return function function obj return -
I'm very happy visiting Stackoverflow more often then Facebook these days. Today I landed on this question. I'm not sure that I understand the real context of the situation, but I found something helpful, which may be useful for you. What if we have an object and want to use it as a base for JavaScript class (i.e. function). The idea is to create instances and basically extend the original object.
read more
-
JavaScript: sequencing function calls #2
posted in JavaScript on 2013-07-10 chain error console log arguments function res chain errors run object chainends -
I created a simple JavaScript library for running functions in a sequence. The story behind this is published here. Today I made few interesting changes which deserve a new blog post.
read more
-
Chrome extension: debugging dev tools tab or how to make console.log
posted in JavaScript on 2013-06-18 chrome dev tools obj message alert chrome runtime console log bglog function work -
It's really interesting to work on an extension for Chrome. However, sometimes it's a little bit difficult to debug. Especially when you work on a dev tools add-on (i.e. a new tab).
read more
-
A strange IOErrorEvent.IO_ERROR event dispatched
posted in ActionScript on 2013-06-11 urlrequest var urlloader addeventlistener json encode obj string http site urlstring string http var urlstring string problem -
Really simple GET request from a flex based application. However it fails if GET parameters are passed.
read more
-
JavaScript object creation
posted in JavaScript on 2012-03-04 javascript discusses object creation peters discusses object keith peters discusses article keith peters operator check prototypal inheritance alternative -
In this article, Keith Peters discusses object creation in JavaScript using prototypal inheritance as an alternative to the new operator. Check out here.
read more
-
AS3: converting XML to JSON object
posted in ActionScript on 2011-04-02 label url image xml id img cdata node var version xml2json class http site int childnode object -
I'm absolutely sure that you are using external data in your flash/flex applications. It is a good practice to transfer information in XML format. Most of the projects that I'm working on also use XML and in most of them I have a class that converts the data to JSON object. The problem with this workflow is that the parser's logic is always different because the XML is different. These days I wrote a class that solved this problem and directly converted every given XML file to a JSON object.
read more
-
GoogleMaps API v3: convert LatLng object to actual pixels
posted in JavaScript on 2011-01-07 map var map getprojection fromlatlngtopoint worldpoint scale object fromlatlngtopoint map getbounds getprojection fromlatlngtopoint map -
It is not so easy as it looks like. You should get the map object's projection and the map's zoom to be able to calculate it.
read more
-
Cloning JSON object in JavaScript
posted in JavaScript on 2010-10-04 obj obj1 outpurarr var document write obj2 object getname function return obj var outpurarr clone obj var function clone obj -
Simple and easy solution.
read more
-
Create your own tween manager class in AS3
posted in ActionScript on 2010-08-07 arr ease startpos calcendpos steps var calcendpos steps break object steps break case properties start public function -
There are some features in Flash that we can't work without. Tween classes are among the most used ones. They give you ability to animate objects without using the timeline, to change the animation fast and easy. The idea of these classes is very simple. That's why I think that it is a good idea to have your own tween manager that you can modify to fit into your needs.
read more
-
Papervision3d: Finding 2D coordinates of a 3D object
posted in ActionScript on 2010-07-25 private var 3d number import org papervision3d addsphereandtooltip item mousey mousex basicview displayobject3d event -
Papervision3d is probably the most popular 3D flash engine. There are dozen of applications/sites that use it. These days I also decided to create a 3D effect in my portfolio site. Everything works fine, but I needed a tooltip for each of the 3D objects on my scene. To be able to animate everything I needed 2D coordinates of all my 3D elements.
read more
-
Trace JSON object in AS3
posted in ActionScript on 2010-07-17 str description gettypeof o spaces var object information users -
I'm absolutely sure that all of you are working with JSON objects. It's pretty helpful to be able to print them and find out what exactly they contain. I wrote a simple function that makes this possible.
read more
-
Tween Manager Class in AS3
posted in ActionScript on 2010-03-16 customproperty object tween tweenmanager xtween property function change tweenmanager tween loop end -
TweenManager is ActionScript3 class that helps you to animate your objects in flash. You don't need to create timeline type animations, because you can control every property of the object. Also it helps you to create a sequence by different animations/events. In the examples below I'll show you how to use the manager to solve different problems during your daily flash work.
read more