0

Recently I'm facing a problem of page loading. So I want something like AOT compilation for accelerating JavaScript executing speed. But I haven't seen anything like this. Is it Angular AOT compilation compatible for modern browser js runtime? Or it just only work for Angular?

JamesYin
  • 732
  • 9
  • 19
  • Angular is a Js framework at the end it just compiles js in AOT, you can use native js in Angular also, but is generally recommened to do it Angular way – Rahul Singh Aug 30 '17 at 07:30
  • @RahulSingh Thanks your comment. After AOT, Angular's output file is still a js file? It still need JIT to run it. Right? – JamesYin Aug 30 '17 at 07:33
  • You are confused between JIT and AOT please read the documentation check this https://stackoverflow.com/questions/41450226/angular-2-just-in-time-jit-vs-ahead-of-time-aot-compilation – Rahul Singh Aug 30 '17 at 07:36
  • I understand what they mean. I think I confused the scope of capable. AOT is only use for Angular to compile html syntax to JavaScript. JIT is used for running JavaScript. Am I right? – JamesYin Aug 30 '17 at 07:41

1 Answers1

0

AOT availability depends on your framework. You can do it for example with Angular (the v2) but not AngularJS (the v1).

And you can't do it for vanilla JS.

CCH
  • 1,516
  • 1
  • 13
  • 24
  • Why Angular's document compare it with JIT. At last it still need JIT to execute. – JamesYin Aug 30 '17 at 07:35
  • JIT (Just In Time) means that the compilation is done automatically in the browser at runtime. You don't anything in particular (except a browser) for _JIT to execute_ – CCH Aug 30 '17 at 07:36
  • Thanks. I understand now. AOT is only used for Angular compilation. – JamesYin Aug 30 '17 at 07:46