BOM (Browser object model (Browserobjectmodel)), which allows access to and manipulation of browser windows. By using the BOM, developers can move windows, change status bar text, and perform other actions that do not directly relate to the content of the page. This article starts with the following four types of services in ExtJS:1, name space2, User agent object3,cookie4, timed call function (will be presented in detail in the next post)
name Space
The namespace of the ExtJS is the creation of a separate scope within the global scope provided by the Window object, conceptually similar to the Java package.
Ext.namespace ("Com.baidu"); Console.info (typeof com); // Objectconsole.info (typeof Com.baid); // Object
The "Com.baidu" string is parsed using Ext.namespace, and becomes two objects after completion, one is COM, and the other is COM owned property, Baidu. with Ext.namespace (), the actual development can avoid naming conflicts caused by work partners or third-party developers You can create such namespaces in your project to use when reading shared data between modules, but should be limited to self-read variables. If data is exchanged between modules, it is better to use the event mechanism or to hand over the data to the backend server.
User Agent Objects
The
User Agent object refers to the Window.navigator.userAgent attribute , which stores information such as the model of the user's browser, the
operating system, and the name of the rendering engine, which are some of the conditions for judging the browser type. In the past, some browser makers have been fiddling with this property, making scripts misread or mistakenly judging the type of browser, so programmers have to write very complex scripts to make judgments. The following is an introduction to ext simple Boolean conditional expressions
Property |
Description |
Ext.isair |
Determine if the execution environment is Adobel AIR |
Ext.isborderbox |
Determine if the IE browser being executed is in a non-rigorous (non-strict) mode |
Ext.isgecko/ext.isgecko2/ext.isgecko3 |
Determine if a version of the Gecko rendering engine |
Ext.ischrome |
Determine if Google Chrome is a browser |
Ext.isie/ext.isie6/ext.isie7/ext.isie8 |
Determine if it is IE browser |
Ext.issafari/ext.issafari2/ext.issafari3/ext.issafari4 |
Determine if a version of the Safari browser |
Ext.iswebkit |
Determine if the browser is a WebKit browser |
Ext.isstrict |
Determine if the browser is in strict mode |
Ext.iswindows |
Determine the user operating system for Windows |
Ext.ismac |
Determine the user operating system for Mac |
Ext.islinux |
Determine the user operating system for Linux |
Cookiescookie operation is very simple, there are only three methods:Clear (name): Clears the value set for nameSet (Name,value): Sets the value of name toGet (name): Gets the value of the name setting
var simlevalue = "A simple string"; var complevalue = { "comple", "I ' m so Complex" }; Ext.util.Cookies.set (' simple ', simplevalue); Ext.util.Cookies.set (' complex ', complevalue); Ext.util.Cookies.set (' Complexjson ', Ext.encode (Complexvaule));
Cookies can only store text, if you want to store objects, you must json the object, that is, call Ext.encode (), this method will be complex object structure into a string, when removed as long as the love class string is dropped to Ext.decode (), You can convert the string to the original object type.