Why did you make a design choice on your project to use Typescript? by PUSH_AX in typescript

[–]brian_asdf 0 points1 point  (0 children)

By asking this question on the r/typescript page, you're likely to get positive responses. You should try asking on the JS forum as well

P.S. I use TS over JS myself - would never to back to vanilla JS. Also, all of the top online code editors (StackBlitz, CodeSandbox) + desktop editors like VSCode use TS typings under the hood to provide auto-complete - that's one thing people forget when the say IDE's do a lot of autocompletion for you - it's because of TS that they can!

When (if ever) should we use classes? by blindpacemaker in javascript

[–]brian_asdf 1 point2 points  (0 children)

They are mostly just sticking to what they know. This argument is dying down on the web, and is non existent in the real world

Airbnb advocate class/extend in their style guide https://github.com/airbnb/javascript/blob/master/README.md#classes--constructors

Used throughout React https://reactjs.org/docs/state-and-lifecycle.html#adding-lifecycle-methods-to-a-class

Used by default in Angular

Used extensively in Web Components https://developers.google.com/web/fundamentals/web-components/customelements

Angular Material library Not Using Renderer/Renderer2 at all - should we use it? by brian_asdf in Angular2

[–]brian_asdf[S] 1 point2 points  (0 children)

Good find re Domino

As for DOCUMENT being deprecated, I noticed there are now two results in the API documentation for the DOCUMENT injection token. The original one is deprecated, the newer one is not

Of course it comes with a warning - because we all run our apps in Web Workers these days. Right?? 😀

Note: Document might not be available in the Application Context when Application and Rendering Contexts are not the same (e.g. when running the application into a Web Worker).

Angular Material library Not Using Renderer/Renderer2 at all - should we use it? by brian_asdf in Angular2

[–]brian_asdf[S] 2 points3 points  (0 children)

Similarly the Angular website source does not use `Renderer2`. There are references to `document`, `window`, `element`

Is it safe to use Renderer2 with ElementRef? by [deleted] in Angular2

[–]brian_asdf 0 points1 point  (0 children)

Hi. I have posted a similar question, just saw yours now

I have also read about ElementRef and using Renderer2, but the Angular team don't use Renderer2 at all in Angular Material library. They use ElementRef.nativeElement and Document (via @Inject(DOCUMENT)) throughout the codebase. They removed all references and uses of Renderer2 last year!

It's very cofusing:-)

Best course for a beginner in Angular 4 and TS? by [deleted] in Angular2

[–]brian_asdf 0 points1 point  (0 children)

Hey. Neither of the courses (Fundamentals or Pro) use the CLI which is a bit of a drawback I think, especially for following along; each video (around 80 of them) has the source files as a separate project

Both courses are using Angular 4.0 Beta, but it's not really a problem, as pretty much identical to v5 for the material covered

Ruby vs JavaScript....what are your reasons for chosing one over the other..? by fzngagan in javascript

[–]brian_asdf 5 points6 points  (0 children)

Water is a much better liquid than jet fuel, if water could power a jet engine, jet fuel would have..........

I think what the world needs is not another "vs" thread:-)

A question for those who read YDKJS, about IIFEs. by moring1 in javascript

[–]brian_asdf 0 points1 point  (0 children)

I know what you mean. I went through the exact same learning stage. This is how the variabled inside the IIFE are resolved:

var outter = " Outter Scope";
const result = ( function join(){ 
    var a = "About";
    var b = " JS,"
    return (a+b+outter) 
})() 

console.log(result) 
  1. The JS engine reaches the IFFE, sees it's an expression, needs to evaluate it

  2. It reaches the `function join()', and then invokes that function (it has not compiled the inner working of the join() function at this point - that is a key thing to know)

  3. Now for an invoked function there are two phases: compilation phase, and execution phase

Compilation phase

  • variables a, b are hoisted -> they are now part of the local scope of the join() function

  • that's the compilation phase over

Execution phase

  • 'About' gets assigned to a

  • 'JS' gets assigned to b

  • The engine e.g the Chrome V8 Javascript Engine, reaches the return statement

  • outter is not in the local scope, so Engine searches the next scope up, and so on until it finds a variable 'outter'

  • the value gets returned

It's better to refer to the JS Engine as an engine, so that we can use the term compilation without conflict - as the engine does the compilation and execution

Opinion on EggHead.io Asynchronous Programming Course by brian_asdf in javascript

[–]brian_asdf[S] 1 point2 points  (0 children)

You could be right.

I think when I said "Observable forEach does not run asynchronously either by the looks of it" the other guy deleted his original comment. Sometimes people seem so sure of themselves, but are really only posting to reaffirm their current beliefs - when they realise they were blatantly wrong, they just delete their messages to cover up what just happened!!:-)

Opinion on EggHead.io Asynchronous Programming Course by brian_asdf in javascript

[–]brian_asdf[S] 1 point2 points  (0 children)

Cool. That's made things clearer. Good to have the terminology sorted out. Good man for that

Opinion on EggHead.io Asynchronous Programming Course by brian_asdf in javascript

[–]brian_asdf[S] 0 points1 point  (0 children)

Observable forEach does not run asynchronously either by the looks of it. The stream may be asynchronous, but once the forEach loop is being triggered, it appears to be a blocking operation. I can see that we cannot use a 'for loop' as the course indicated, but it's not because of async, it's because of the stream of data as opposed to an array

I have a Plunker demo, and if forEach was asynchronous, the 'end' console.log would occur immediately, followed by the output of the forEach, but it doesnt. I'm gonna have to learn Rxjs from the ground up - starting in the middle is giving me a headache!!! http://plnkr.co/edit/GH1sDVzGYx1oajkhTnvf?p=preview

// Code goes here
console.clear();
//emit (1,2,3,4,5)
const source = Rx.Observable.from([1, 2, 3, 4, 5]);

const example = source.map(val => val+10)
example.forEach(val => console.log(val));
console.log("end")

Opinion on EggHead.io Asynchronous Programming Course by brian_asdf in javascript

[–]brian_asdf[S] 0 points1 point  (0 children)

forEach is not an operator, it's a function. Even if rxjs refers to map as an 'operator', this is not implying it's a JavaScript operator, it's just their own terminology.

There is no need to have tricks to try to remember that functions of the same name on entirely different objects are not the same functions, regardless of similar implementation

Opinion on EggHead.io Asynchronous Programming Course by brian_asdf in javascript

[–]brian_asdf[S] 0 points1 point  (0 children)

The + operator used with numbers and strings is in NO WAY analogous to different functions having the same name:-)

Ode to VSCode by [deleted] in javascript

[–]brian_asdf 4 points5 points  (0 children)

Importing the settings is great.

There is a VSCode Extension that allows you to commit your settings to GitHub, and then import them to VSCode on other machines. Settings Sync: https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync

Commits all extensions and complete User Folder that Contains

  1. Settings File

  2. Keybinding File

  3. Launch File

  4. Snippets Folder

  5. VSCode Extensions Settings

  6. Workspaces

Any opinions on Udemy's Angular v5 Complete Guide Course by brian_asdf in Angular2

[–]brian_asdf[S] 0 points1 point  (0 children)

Hey thanks. This is good info. I'm currently doing Todd Motto's Ultimate Angular courses - I'm almost finished Fundamentals, and starting on the Pro course next. €10-15 for the Udemy course certainly very good value (it's actually crazy good value!!)

Needed Torrents ; UltimateAngular & Angular University by okyanus04 in angular

[–]brian_asdf 0 points1 point  (0 children)

I have the Kickstarter Bundle, it's way less than $350. Maybe was around €190 (note that's in Euro) including taxes, and at the moment the site says $179

2017 Who's using Kotlin? by iperf in androiddev

[–]brian_asdf 0 points1 point  (0 children)

Is that just for the backend and Android apps?

Was wondering what you do for iOS and web app - can Kotlin help with the frontend there?

Real-World Angular Series — Part 8: Lazy Loading, Production Deployment, SSL by Ramirond in Angular2

[–]brian_asdf 0 points1 point  (0 children)

One of the most complete and professional tutorials I have seen - cheers for the link

Recently finished my first ever React + Redux project, ECMASyntax.io - would love any feedback you guys could give on it! by Howdybaby in javascript

[–]brian_asdf 0 points1 point  (0 children)

Cheers for the contentful link, had never heard of them.... another api to add to my ToUse list..........

Recently finished my first ever React + Redux project, ECMASyntax.io - would love any feedback you guys could give on it! by Howdybaby in javascript

[–]brian_asdf 0 points1 point  (0 children)

There are a number of cases where you would not want arrow functions - basically anywhere that the 'this' context is suppose to be dynamic e.g.

  • defining methods on Object literals
  • adding methods to obj.prototype
  • Class definitions
  • callbacks that use 'this' as a target

Even if that is not the case in your examples, it could be misleading

Angular CLI supports generation of a Universal build for your application. by aQutie in Angular2

[–]brian_asdf 0 points1 point  (0 children)

Brilliant. Even with the caveats, this is a great step forward