Skip to main content

Home/ Larvata/ Group items tagged Javascript

Rss Feed Group items tagged

張 旭

也许,DOM 不是答案 - 阮一峰的网络日志 - 0 views

  • 如果将来有一天,Web app会成为主流,一定有一个前提,那就是它的性能可以赶上Native app
  • Web app输给Native app的地方,不是界面(UI),而是操作性能
  • Web基于DOM,而DOM很慢。浏览器打开网页时,需要解析文档,在内存中生成DOM结构,如果遇到复杂的文档,这个过程是很慢的。可以想象一下,如果网页上有上万个、甚至几十万个形状(不管是图片或CSS),生成DOM需要多久?更不要提与其中某一个形状互动了。
  • ...10 more annotations...
  • 所有的DOM操作都是同步的,会堵塞浏览器。JavaScript操作DOM时,必须等前一个操作结束,才能执行后一个操作。
  • 浏览器重绘网页的频率是60FPS(即16毫秒/帧),JavaScript做不到在16毫秒内完成DOM操作,因此产生了跳帧。
  • 没有使用DOM,而是将整个网站用canvas输出
  • canvas可以被硬件加速
  • 主要是canvas只是一个位图,本身没有语义,如果要在它上面实现UI,等于HTML语言已有的东西都要再发明一遍,比如如何实现超链接、如何实现CSS效果等等。
  • canvas不是自适应的(responsive),文字在哪里断行,都要自己计算,而且用户也无法选中文本
  • 多线程浏览器
  • DOM的异步操作。JavaScript对DOM的操作不再是同步的,而是触发后,交给Event Loop机制进行监听。
  • 用数据库取代DOM
  • 非DOM方案。浏览器不再将网页处理成DOM结构,而是变为其他结构
crazylion lee

dmlc/mxnet: Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynam... - 0 views

  •  
    "Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more http://mxnet.io"
crazylion lee

Chart.js | Open source HTML5 Charts for your website - 0 views

  •  
    " Simple yet flexible JavaScript charting for designers & developers"
crazylion lee

Social Media Sharing Buttons. No JavaScript. No tracking. Super fast and easy. - 0 views

  •  
    "Super fast and easy Social Media Sharing Buttons. No JavaScript. No tracking."
crazylion lee

JavaPoly.js - Java(script) in the Browser - 0 views

  •  
    "JavaPoly.js is a library that polyfills native JVM support in the browser. It allows you to import your existing Java code, and invoke the code directly from Javascript."
張 旭

AngularJS for jQuery Developers | Art & Logic Blog - 0 views

  • Angular does not treat HTML or JavaScript as a bug that needs to be fixed
  • JavaScript code treats DOM in an imperative manner: take this node and that attribute, look at its value, do this or that.
  • Direct manipulation of the DOM is not only unnecessary, it is discouraged in the Angular approach.
  • ...11 more annotations...
  • DOM should be specified in views
  • data in scopes
  • functionality in controller
  • non-trivial transformations in custom filters and directives.
  • Binding a DOM value to a model in a controller scope
  • Any controller that needs to use this JSON data, can do so by including DataSource as one of the controller parameters
  • Include $http in the parameters.
  • Include $log as your controller function argument.
  • What happens internally is this: Angular analyzes your function’s source code, finds the arguments, and infers from them the services your code requires.
    • 張 旭
       
      這段好像就是在講丟參數進去時,AngularJS 會判斷。 不管順序,但是名稱好像需要固定,而且要有 $ 號。
  • Angular predefines reasonable defaults for getting, setting, deleting, and querying records.
張 旭

javascript - How do I "think in AngularJS" if I have a jQuery background? - Stack Overflow - 0 views

  • in AngularJS, we have a separate model layer that we can manage in any way we want, completely independently from the view.
  • keep your concerns separate
  • do DOM manipulation and augment your view with directives
  • ...34 more annotations...
  • DI means that you can declare components very freely and then from any other component, just ask for an instance of it and it will be granted
  • do test-driven development iteratively in AngularJS!
  • only do DOM manipulation in a directive
  • with ngClass we can dynamically update the class;
  • ngBind allows two-way data binding;
  • ngShow and ngHide programmatically show or hide an element;
  • The less DOM manipulation, the easier directives are to test, the easier they are to style, the easier they are to change in the future, and the more re-usable and distributable they are.
  • still wrong.
  • Before doing DOM manipulation anywhere in your application, ask yourself if you really need to.
  • a few things wrong with this
  • jQuery was never necessary
  • use angular.element and our component will still work when dropped into a project that doesn't have jQuery.
  • just use angular.element
  • the element that is passed to the link function would already be a jQuery element!
  • directives aren't just collections of jQuery-like functions
  • Directives are actually extensions of HTML
  • If HTML doesn't do something you need it to do, you write a directive to do it for you, and then use it just as if it was part of HTML.
  • think how the team would accomplish it to fit right in with ngClick, ngClass, et al.
  • Don't even use jQuery. Don't even include it.
  • ry to think about how to do it within the confines the AngularJS.
  • In jQuery, selectors are used to find DOM elements and then bind/register event handlers to them.
  • Views are (declarative) HTML that contain AngularJS directives
  • Directives set up the event handlers behind the scenes for us and give us dynamic databinding.
  • Views are tied to models (via scopes). Views are a projection of the model
  • In AngularJS, think about models, rather than jQuery-selected DOM elements that hold your data.
  • AngularJS uses controllers and directives (each of which can have their own controller, and/or compile and linking functions) to remove behavior from the view/structure (HTML). Angular also has services and filters to help separate/organize your application.
  • Think about your models
  • Think about how you want to present your models -- your views.
  • using the necessary directives to get dynamic databinding.
  • Attach a controller to each view (using ng-view and routing, or ng-controller)
  • Make controllers as thin as possible.
  • You can do a lot with jQuery without knowing about how JavaScript prototypal inheritance works.
  • jQuery is a library
  • AngularJS is a beautiful client-side framework
crazylion lee

NamPNQ/You-Dont-Need-Javascript: Css is powerful, you can do a lot of things without js. - 0 views

  •  
    "Css is powerful, you can do a lot of things without js."
張 旭

New UI Pattern: Website Loading Bars · UsabilityPost - 0 views

  •  
    "the reason to use the bar is because you're switching content via JavaScript rather than loading a new page. This makes sense since the browser's own loading indicator may not get triggered. "
張 旭

#JavaScript:this用法整理 - 翼世界夢想領域 - 0 views

  • JavaScript裡的this看的是究竟是誰調用該函式,而不是看該函式被定義在哪個物件內
  • call與apply都是呼叫該函式並讓該函式的this指向給予call或apply的第一個參數。
  • call和apply的差別則是在於其後面給予被調用之函式的參數放入的方法不同
  • ...2 more annotations...
  • 為什麼常常別人實作的callback函式可讓this指向於調用放入該callback的函式之this所指向之物件呢?
  • 實作上會遵守一個規則,會將自己的this或是直觀上合理的物件傳給callback當作它的this來用!
crazylion lee

Thimble by Mozilla - An online code editor for learners & educators. - 0 views

  •  
    "Thimble is an online code editor that makes it easy to create and publish your own web pages while learning HTML, CSS & JavaScript."
snow9816

Apache 中 KeepAlive 配置的合理使用 - 煎炸熊の記事本 - 0 views

  • KeepAlive 配置指令決定當處理完用戶發起的 HTTP 請求後是否立即關閉 TCP 連接,如果 KeepAlive 設置為On,那麼用戶完成一次訪問後,不會立即斷開連接,如果還有請求,那麼會繼續在這一次 TCP 連接中完成,而不用重複建立新的 TCP 連接和關閉TCP 連接,可以提高用戶訪問速度。
  • 那麼我們考慮3種情況: 1。用戶瀏覽一個網頁時,除了網頁本身外,還引用了多個 javascript 文件,多個 css 文件,多個圖片文件,並且這些文件都在同一個 HTTP 服務器上。 2。用戶瀏覽一個網頁時,除了網頁本身外,還引用一個 javascript 文件,一個圖片文件。 3。用戶瀏覽的是一個動態網頁,由程序即時生成內容,並且不引用其他內容。 對於上面3中情況,我認為:1 最適合打開 KeepAlive ,2 隨意,3 最適合關閉 KeepAlive
  • 假設 KeepAlive 的超時時間為 10 秒種,服務器每秒處理 50個獨立用戶訪問,那麼系統中 Apache 的總進程數就是 10 * 50 = 500 個,如果一個進程佔用 4M 內存,那麼總共會消耗 2G內存
crazylion lee

Node-RED - 0 views

  •  
    "A visual tool for wiring the Internet of Things"
‹ Previous 21 - 40 of 98 Next › Last »
Showing 20 items per page