Angular 2, JavaScript, ng2-dynamic-dialog, Programming, TypeScript

Merging CSS Classes for use with ngStyle

For the release of ng-dynamic-dialog v2, I wanted to move away from defining the dialogs look in TypeScript and use standard CSS classes. This would allow the style of the dialog to be defined alongside the rest of a websites style, and make it compatible with CSS preprocessors like LESS and SASS. What Was I… Continue reading Merging CSS Classes for use with ngStyle

Angular 2, ng2-dynamic-dialog, ng2-file-drop

ng2-file-drop and ng2-dynamic-dialog updated to Angular 2.0.0

Google finally finally released the official version of Angular 2 the other day.  As a result I needed to updated both ng2-file-drop and ng2-dynamic-dialog to build against the new version. Given the hassle of going from RC4 to RC5, I wasn't optimistic this would be a quick job. However, other than having to change a… Continue reading ng2-file-drop and ng2-dynamic-dialog updated to Angular 2.0.0

Angular 2, JavaScript, TypeScript

Angular 2 – Dynamically Injecting Components

Note this also covers upgrading from RC4 to RC5's ComponentFactoryResolver. I recently upgraded from RC4 to RC5 and as a result my dynamic component injection module failed due to ComponentResolver being deprecated. Of all the changes between RC4 and RC5, this seems to be the simplest deprecation step, but though I'd document it here. Generating… Continue reading Angular 2 – Dynamically Injecting Components

Angular 2, ng2-dynamic-dialog, npm, TypeScript

Ng2-dynamic-dialog 0.0.4 Released

It took me a few tries, but ng2-dynamic-dialog 0.0.4 has now been released and is available to be used by any Angular 2 apps out there. It is currently built against RC4 (RC5 will be in 0.0.5). The npm documentation and package is here https://www.npmjs.com/package/ng2-dynamic-dialog GitHub project is here https://github.com/leewinder/ng2-dynamic-dialog While the links above go… Continue reading Ng2-dynamic-dialog 0.0.4 Released

JavaScript, TypeScript

TypeScript, ‘this’ Scope and JavaScript callbacks

Using 'setInterval' caught me out today Now given any object orientated library, you would expect that after every 400 milliseconds you would get a '1' in the output log. 'setIntervalCallback' is a member function of SetIntervalTest, it references 'this' which scope out dicate to be the instance of SetIntervalTest we're running in. But instead of… Continue reading TypeScript, ‘this’ Scope and JavaScript callbacks

Development, Mac OS, Obj-C, Programming

Objective-C Swizzling without Side Effects

<tl;dr> Using method_exchangeImplementations results in a number of unexpected and dangerous side effects which in most cases you’ll want to avoid. You should use method_setImplementation and swizzle a C-style function instead to give yourself more control over your applications behaviour. </tl;dr>   Swizzling is an incredibly powerful, and incredibly dangerous, feature of Objective-C that in… Continue reading Objective-C Swizzling without Side Effects

Mac OS, Obj-C, Programming, Unit Testing

Injecting data into Obj-C readonly properties

<tl;dr> If you want to inject data into an object that only has read-only properties, swizzle the synthesised getter function so you can inject the data you need at the point it’s accessed. For example </tl;dr>   I recently needed to set up some client side unit tests for our iOS receipt verification server. This… Continue reading Injecting data into Obj-C readonly properties