KISSY
The KISSY global namespace object. you can use
KISSY.each/mix
to do basic operation.
or
KISSY.use("overlay,node",function(S,Overlay,Node){
//
})
to do complex task with modules.
defined in: kissy.js
Namespace
Attributes
- KISSY. version {} <static> The version of the library.
Methods
- KISSY. add (name, fn, cfg) <static> Registers a module with the KISSY global.
- KISSY. augment (r, s1) <static> Applies prototype properties from the supplier to the receiver.
- KISSY. available (id, fn) <static> Executes the supplied callback when the item with the supplied id is found.
- KISSY. bind (fn, obj, arg1) <static> Creates a new function that, when called, itself calls this function in the context of the provided this value, with a given sequence of arguments preceding any provided when the new function was called.
- KISSY. buffer (fn, context, ms) <static> buffers a call between a fixed time
- KISSY. clone (input, filter) <static> Creates a deep copy of a plain object or array.
- KISSY. config (c, v) <static> set KISSY configuration
- KISSY. each (object, fn, context) <static> Executes the supplied function on each item in the array.
- KISSY. endsWith (str, suffix) <static> test whether a string end with a specified substring
- KISSY. equals (a, b, mismatchKeys, mismatchValues) <static> Checks to see whether two object are equals.
- KISSY. error (msg) <static> Throws error message.
- KISSY. escapeHTML (str) <static> get escaped string from html
- KISSY. escapeRegExp (str) <static> get escaped regexp string for construct regexp
- KISSY. every (arr, callback, context) <static> Tests whether all elements in the array pass the test implemented by the provided function.
- KISSY. extend (r, s, px, sx) <static> Utility to set up the prototype, constructor and superclass properties to support an inheritance strategy that can chain constructors and methods.
- KISSY. filter (arr, fn, context) <static> Executes the supplied function on each item in the array.
- KISSY. fromUnicode (str) <static> frequently used in taobao cookie about nick
- KISSY. getLoader () <static> get KISSY's loader instance
- KISSY. globalEval (data) <static> Evalulates a script in a global context.
- KISSY. inArray (item, arr) <static> Search for a specified value index within an array.
- KISSY. indexOf (item, arr) <static> Search for a specified value within an array.
- KISSY. isArray (o) <static> test whether o is Array
- KISSY. isBoolean (o) <static> test whether o is boolean
- KISSY. isDate (o) <static> test whether o is Date
- KISSY. isEmptyObject (o) <static> Checks to see if an object is empty.
- KISSY. isFunction (o) <static> test whether o is function
- KISSY. isNull (o) <static> whether o === null
- KISSY. isNumber (o) <static> test whether o is number
- KISSY. isObject (o) <static> test whether o is Object
- KISSY. isPlainObject (o) <static> Checks to see if an object is a plain object (created using "{}" or "new Object()" or "new FunctionClass()").
- KISSY. isRegExp (o) <static> test whether o is RegExp
- KISSY. isString (o) <static> test whether o is String
- KISSY. isUndefined (o) <static> whether o === undefined
- KISSY. isWindow (o) <static> A crude way of determining if an object is a window
- KISSY. keys (o) <static> Get all the property names of o as array
- KISSY. lastIndexOf (item, arr) <static> Returns the index of the last item in the array that contains the specified value, -1 if the value isn't found.
- KISSY. later (fn, when, periodic, context, data) <static> Executes the supplied function in the context of the supplied object 'when' milliseconds later.
- KISSY. log (msg, cat, src) <static> Prints debug info.
- KISSY. makeArray (o) <static> Converts object to a true array.
- KISSY. map (arr, fn, context) <static> Executes the supplied function on each item in the array.
- KISSY. merge (m1) <static> Returns a new object containing all of the properties of all the supplied objects.
- KISSY. mix (r, s, ov, wl, deep) <static> Copies all the properties of s to r.
- KISSY. namespace () <static> Returns the namespace specified and creates it if it doesn't exist.
- KISSY. noop () <static> empty function
- KISSY. now () <static> Gets current date in milliseconds.
- KISSY. param (o, sep, eq, arr) <static> Creates a serialized string of an array or object.
- KISSY. parseXML (data) <static> get xml representation of data
- KISSY. ready (fn) <static> Specify a function to execute when the DOM is fully loaded.
- KISSY. reduce (arr, callback, initialValue) <static> Executes the supplied function on each item in the array.
- KISSY. some (arr, callback, context) <static> Tests whether some element in the array passes the test implemented by the provided function.
- KISSY. stamp (o, readOnly, marker) <static> stamp a object by guid
- KISSY. startsWith (str, prefix) <static> test whether a string start with a specified substring
- KISSY. substitute (str, o, regexp) <static> Substitutes keywords in a string using an object/array.
- KISSY. throttle (fn, context, ms) <static> Throttles a call to a method based on the time between calls.
- KISSY. trim () <static> Removes the whitespace from the beginning and end of a string.
- KISSY. type (o) <static> Determine the internal JavaScript [[Class]] of an object.
- KISSY. unEscapeHTML (str) <static> un-escape html to string
- KISSY. unique (a, override) <static> Returns a copy of the array with the duplicate entries removed
- KISSY. unparam (str, sep, eq) <static> Parses a URI-like query string and returns an object composed of parameter/value pairs.
- KISSY. use (names, callback) <static> Attached one or more modules to global KISSY instance.
Namespace Detail
-
KISSYThe KISSY global namespace object. you can use
KISSY.each/mix
to do basic operation. orKISSY.use("overlay,node",function(S,Overlay,Node){ // })
to do complex task with modules.
Methods Detail
-
Registers a module with the KISSY global.
Defined in:init.js.- Parameters
-
- [ name ] {String} module name. it must be set if combine is true in KISSY.config
- fn {Function} module definition function that is used to return this module value
- fn.S {KISSY} KISSY global instance
- fn.x... this module's required modules' value
- [ cfg ] {Object} module optional config data
- cfg.requires {String[]} this module's required module name list
- Example
-
-
// dom module's definition
KISSY.add("dom",function(S,UA){ return { css:function(el,name,val){} }; },{ requires:["ua"] });
-
-
Applies prototype properties from the supplier to the receiver.
- Parameters
-
- r {Object} received object
- s1 {...Object} object need to augment {Boolean} [ov=true] whether overwrite existing property {String[]} [wl] array of white-list properties
- Returns
-
- {Object} the augmented object
-
Executes the supplied callback when the item with the supplied id is found.
Defined in:web.js.- Parameters
-
-
id
The id of the element, or an array of ids to look for. -
fn
What to execute when the element is found.
-
id
-
Creates a new function that, when called, itself calls this function in the context of the provided this value, with a given sequence of arguments preceding any provided when the new function was called.
Defined in:lang.js.- Parameters
-
- fn {Function} internal called function
- obj {Object} context in which fn runs
- arg1 {...} extra arguments
- Returns
-
- {Function} new function with context and arguments
- See
-
- https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind
-
buffers a call between a fixed time
Defined in:lang.js.- Parameters
-
- fn {function}
- [ context ] {object}
- ms {Number}
- Returns
-
- {function} Returns a wrapped function that calls fn buffered.
-
Creates a deep copy of a plain object or array. Others are returned untouched.
Defined in:lang.js.- Parameters
-
- input
- [ filter ] {Function} filter function
- Returns
-
- the new cloned object
- See
-
- http://www.w3.org/TR/html5/common-dom-interfaces.html#safe-passing-of-structured-data
-
set KISSY configuration
- Parameters
-
- c {Object|String} Config object or config key.
- c.base {String} KISSY 's base path. Default: get from kissy(-min).js or seed(-min).js
- c.tag {String} KISSY 's timestamp for native module. Default: KISSY 's build time.
- c.debug {Boolean} whether to enable debug mod.
- c.combine {Boolean} whether to enable combo.
- c.packages {Object} Packages definition with package name as the key.
- c.packages.base {String} Package base path.
- c.packages.tag {String} Timestamp for this package's module file.
- c.packages.debug {String} Whether force debug mode for current package.
- c.packages.combine {String} Whether allow combine for current package modules.
- c.map {Array[]} file map File url map configs.
- c.map.0 {Array[]} A single map rule.
- c.map.0.0 {RegExp} A regular expression to match url.
- c.map.0.1 {String|Function} Replacement for String.replace.
- [ v ] config value.
- Example
-
-
// use gallery from cdn
KISSY.config({ combine:true, base:'', packages:{ "gallery":{ base:"http://a.tbcdn.cn/s/kissy/gallery/" } }, modules:{ "gallery/x/y":{ requires:["gallery/x/z"] } } });
// use map to reduce connection countS.config("map",[ [ /http:\/\/a.tbcdn.cn\/s\/kissy\/1.2.0\/(?:overlay|component|uibase|switchable)-min.js(.+)$/, "http://a.tbcdn.cn/s/kissy/1.2.0/??overlay-min.js,component-min.js,uibase-min.js,switchable-min.js$1" ] ]);
-
-
Executes the supplied function on each item in the array.
Defined in:lang.js.- Parameters
-
- object {Object} the object to iterate
- fn {Function} the function to execute on each item. The function receives three arguments: the value, the index, the full array.
- [ context ] {Object}
-
test whether a string end with a specified substring
Defined in:lang.js.- Parameters
-
- str {String} the whole string
- suffix {String} a specified substring
- Returns
-
- {Boolean} whether str end with suffix
-
Checks to see whether two object are equals.
Defined in:lang.js.- Parameters
-
- a 比较目标1
- b 比较目标2
- mismatchKeys
- mismatchValues
- Returns
-
- {Boolean} a.equals(b)
-
Throws error message.
- Parameters
-
- msg
-
get escaped string from html
Defined in:lang.js.- Parameters
-
- str {string} text2html show
- See
-
- http://yiminghe.javaeye.com/blog/788929 http://wonko.com/post/html-escaping
-
get escaped regexp string for construct regexp
Defined in:lang.js.- Parameters
-
- str
-
Tests whether all elements in the array pass the test implemented by the provided function.
Defined in:lang.js.- Parameters
-
- arr {Array} the array to iterate
- callback {Function} the function to execute on each item
- [ context ] {Object} optional context object
- Returns
-
- {Boolean} whether all elements in the array pass the test implemented by the provided function.
-
Utility to set up the prototype, constructor and superclass properties to support an inheritance strategy that can chain constructors and methods. Static members will not be inherited.
- Parameters
-
- r {Function} the object to modify
- s {Function} the object to inherit
- [ px ] {Object} prototype properties to add/override
- [ sx ] {Object} static properties to add/override
- Returns
-
- r {Object}
-
Executes the supplied function on each item in the array. Returns a new array containing the items that the supplied function returned true for.
Defined in:lang.js.- Parameters
-
- arr {Array} the array to iterate
- fn {Function} the function to execute on each item
- [ context ] {Object} optional context object
- Returns
-
- {Array} The items on which the supplied function returned true. If no items matched an empty array is returned.
-
frequently used in taobao cookie about nick
Defined in:lang.js.- Parameters
-
- str
-
get KISSY's loader instance
Defined in:init.js.- Returns
-
Evalulates a script in a global context.
Defined in:web.js.- Parameters
-
- data
-
Search for a specified value index within an array.
Defined in:lang.js.- Parameters
-
- item individual item to be searched
- arr {Array} the array of items where item will be search
- Returns
-
- {Boolean} the item exists in arr
-
Search for a specified value within an array.
Defined in:lang.js.- Parameters
-
- item individual item to be searched
- arr {Array} the array of items where item will be search
- Returns
-
- {number} item's index in array
-
test whether o is Array
Defined in:lang.js.- Parameters
-
- o
- Returns
-
- {Boolean}
-
test whether o is boolean
Defined in:lang.js.- Parameters
-
- o
- Returns
-
- {Boolean}
-
test whether o is Date
Defined in:lang.js.- Parameters
-
- o
- Returns
-
- {Boolean}
-
Checks to see if an object is empty.
Defined in:lang.js.- Parameters
-
- o
-
test whether o is function
Defined in:lang.js.- Parameters
-
- o
- Returns
-
- {Boolean}
-
whether o === null
Defined in:lang.js.- Parameters
-
- o
-
test whether o is number
Defined in:lang.js.- Parameters
-
- o
- Returns
-
- {Boolean}
-
test whether o is Object
Defined in:lang.js.- Parameters
-
- o
- Returns
-
- {Boolean}
-
Checks to see if an object is a plain object (created using "{}" or "new Object()" or "new FunctionClass()").
Defined in:lang.js.- Parameters
-
- o
-
test whether o is RegExp
Defined in:lang.js.- Parameters
-
- o
- Returns
-
- {Boolean}
-
test whether o is String
Defined in:lang.js.- Parameters
-
- o
- Returns
-
- {Boolean}
-
whether o === undefined
Defined in:lang.js.- Parameters
-
- o
-
A crude way of determining if an object is a window
Defined in:web.js.- Parameters
-
- o
-
Get all the property names of o as array
- Parameters
-
- o {Object}
- Returns
-
- {Array}
-
Returns the index of the last item in the array that contains the specified value, -1 if the value isn't found.
Defined in:lang.js.- Parameters
-
- item individual item to be searched
- arr {Array} the array of items where item will be search
- Returns
-
- {number} item's last index in array
-
Executes the supplied function in the context of the supplied object 'when' milliseconds later. Executes the function a single time unless periodic is set to true.
Defined in:lang.js.- Parameters
-
- fn {Function|String} the function to execute or the name of the method in the 'o' object to execute.
- when {Number} the number of milliseconds to wait until the fn is executed.
- [ periodic ] {Boolean} if true, executes continuously at supplied interval until canceled.
- [ context ] {Object} the context object.
- [ data ] that is provided to the function. This accepts either a single item or an array. If an array is provided, the function is executed with one parameter for each array item. If you need to pass a single array parameter, it needs to be wrapped in an array [myarray].
- Returns
-
- {Object} a timer object. Call the cancel() method on this object to stop the timer.
-
Prints debug info.
- Parameters
-
- msg {String} the message to log.
- [ cat ] {String} the log category for the message. Default categories are "info", "warn", "error", "time" etc.
- [ src ] {String} the source of the the message (opt)
-
Converts object to a true array.
Defined in:lang.js.- Parameters
-
- o {object|Array} array like object or array
- Returns
-
- {Array} native Array
-
Executes the supplied function on each item in the array. Returns a new array containing the items that the supplied function returned for.
Defined in:lang.js.- Parameters
-
- arr {Array} the array to iterate
- fn {Function} the function to execute on each item
- [ context ] {Object} optional context object
- Returns
-
- {Array} The items on which the supplied function returned
- See
-
- https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map
-
Returns a new object containing all of the properties of all the supplied objects. The properties from later objects will overwrite those in earlier objects. Passing in a single object will create a shallow copy of it.
- Parameters
-
- m1 {...} objects need to be merged
- Returns
-
- {Object} the new merged object
-
Copies all the properties of s to r.
- Parameters
-
- r {Object} the augmented object
- s {Object} the object need to augment
- [ ov = true ] {Boolean|Object} whether overwrite existing property or config.
- [ ov.overwrite = true ] {Boolean} whether overwrite existing property.
- [ ov.whitelist ] {String[]} array of white-list properties
- [ ov.deep = false ] {Boolean} whether recursive mix if encounter object.
- [ wl ] {String[]} array of white-list properties
- [ deep = false ] {Boolean} whether recursive mix if encounter object.
- Returns
-
- {Object} the augmented object
- Example
-
-
var t={}; S.mix({x:{y:2,z:4}},{x:{y:3,a:t}},{deep:true}) => {x:{y:3,z:4,a:{}}} , a!==t S.mix({x:{y:2,z:4}},{x:{y:3,a:t}},{deep:true,overwrite:false}) => {x:{y:2,z:4,a:{}}} , a!==t S.mix({x:{y:2,z:4}},{x:{y:3,a:t}},1) => {x:{y:3,a:t}}
-
-
Returns the namespace specified and creates it if it doesn't exist. Be careful when naming packages. Reserved words may work in some browsers and not others.
S.namespace('KISSY.app'); // returns KISSY.app S.namespace('app.Shop'); // returns KISSY.app.Shop S.namespace('TB.app.Shop', true); // returns TB.app.Shop
- Returns
-
- {Object} A reference to the last namespace object created
-
empty function
Defined in:lang.js. -
Gets current date in milliseconds.
Defined in:lang.js.- See
-
- https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/now http://j-query.blogspot.com/2011/02/timing-ecmascript-5-datenow-function.html http://kangax.github.com/es5-compat-table/
-
Creates a serialized string of an array or object.
Defined in:lang.js.- Parameters
-
- o {Object} json data
- [ sep = '&' ] {String} separator between each pair of data
- [ eq = '=' ] {String} separator between key and value of data
- [ arr = true ] {Boolean} whether add '[]' to array key of data
- Returns
-
- {String}
- Example
-
-
{foo: 1, bar: 2} // -> 'foo=1&bar=2' {foo: 1, bar: [2, 3]} // -> 'foo=1&bar=2&bar=3' {foo: '', bar: 2} // -> 'foo=&bar=2' {foo: undefined, bar: 2} // -> 'foo=undefined&bar=2' {foo: true, bar: 2} // -> 'foo=true&bar=2'
-
-
get xml representation of data
Defined in:web.js.- Parameters
-
- data {String}
-
Specify a function to execute when the DOM is fully loaded.
Defined in:web.js.- Parameters
-
-
fn
{Function} A function to execute after the DOM is ready
KISSY.ready(function(S){ });
-
fn
{Function} A function to execute after the DOM is ready
- Returns
-
- {KISSY}
-
Executes the supplied function on each item in the array. Returns a value which is accumulation of the value that the supplied function returned.
Defined in:lang.js.- Parameters
-
- arr {Array} the array to iterate
- callback {Function} the function to execute on each item
- initialValue {number} optional context object
- Returns
-
- {Array} The items on which the supplied function returned
- See
-
- https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/reduce
-
Tests whether some element in the array passes the test implemented by the provided function.
Defined in:lang.js.- Parameters
-
- arr {Array} the array to iterate
- callback {Function} the function to execute on each item
- [ context ] {Object} optional context object
- Returns
-
- {Boolean} whether some element in the array passes the test implemented by the provided function.
-
stamp a object by guid
Defined in:lang.js.- Parameters
-
- o {Object} object needed to be stamped
- [ readOnly ] {Boolean} while set marker on o if marker does not exist
- [ marker ] {String} the marker will be set on Object
- Returns
-
- guid associated with this object
-
test whether a string start with a specified substring
Defined in:lang.js.- Parameters
-
- str {String} the whole string
- prefix {String} a specified substring
- Returns
-
- {Boolean} whether str start with prefix
-
Substitutes keywords in a string using an object/array. Removes undefined keywords and ignores escaped keywords.
Defined in:lang.js.- Parameters
-
- str {String} template string
- o {Object} json data
- [ regexp ] {RegExp} to match a piece of template string
-
Throttles a call to a method based on the time between calls.
Defined in:lang.js.- Parameters
-
- fn {function} The function call to throttle.
- [ context ] {object} context fn to run
- [ ms ] {Number} The number of milliseconds to throttle the method call. Passing a -1 will disable the throttle. Defaults to 150.
- Returns
-
- {function} Returns a wrapped function that calls fn throttled.
-
Removes the whitespace from the beginning and end of a string.
Defined in:lang.js. -
Determine the internal JavaScript [[Class]] of an object.
Defined in:lang.js.- Parameters
-
- o
-
un-escape html to string
Defined in:lang.js.- Parameters
-
- str {string} html2text
-
Returns a copy of the array with the duplicate entries removed
Defined in:lang.js.- Parameters
-
- a {Array} the array to find the subset of unique for
- [ override ] {Boolean} if override is true, S.unique([a, b, a]) => [b, a] if override is false, S.unique([a, b, a]) => [a, b]
- Returns
-
- {Array} a copy of the array with duplicate entries removed
-
Parses a URI-like query string and returns an object composed of parameter/value pairs.
Defined in:lang.js.- Parameters
-
- str {String} param string
- [ sep = '&' ] {String} separator between each pair of data
- [ eq = '=' ] {String} separator between key and value of data
- Returns
-
- {Object} json data
- Example
-
-
'section=blog&id=45' // -> {section: 'blog', id: '45'} 'section=blog&tag=js&tag=doc' // -> {section: 'blog', tag: ['js', 'doc']} 'tag=ruby%20on%20rails' // -> {tag: 'ruby on rails'} 'id=45&raw' // -> {id: '45', raw: ''}
-
-
Attached one or more modules to global KISSY instance.
Defined in:init.js.- Parameters
-
- names {String|String[]} moduleNames. 1-n modules to bind(use comma to separate)
- callback {Function} callback function executed when KISSY has the required functionality.
- callback.S {KISSY} KISSY instance
- callback.x... used module values
- Example
-
-
// loads and attached overlay,dd and its dependencies KISSY.use("overlay,dd",function(S,Overlay){});
-
Classes
- Anim
- Anim.Easing
- Attribute
- Base
- Button
- ComboBox
- ComboBox.LocalDataSource
- ComboBox.RemoteDataSource
- Component
- Component.Container
- Component.Controller
- Component.Manager
- Component.Render
- Component.UIBase
- Component.UIBase.Align
- Component.UIBase.Box
- Component.UIBase.Close
- Component.UIBase.Constrain
- Component.UIBase.ContentBox
- Component.UIBase.Drag
- Component.UIBase.Loading
- Component.UIBase.Mask
- Component.UIBase.Position
- Component.UIBase.Resize
- Component.UIBase.StdMod
- Cookie
- DataLazyload
- DD
- DD.Constrain
- DD.DDM
- DD.Draggable
- DD.DraggableDelegate
- DD.Droppable
- DD.DroppableDelegate
- DD.Proxy
- DD.Scroll
- DOM
- Editor
- Editor.Range
- Editor.Utils
- Editor.Walker
- Event
- Event.Object
- Event.Target
- IO
- IO.XhrObject
- KISSY
- KISSY.Defer
- KISSY.Loader
- KISSY.Loader.Module
- KISSY.Loader.Package
- KISSY.Promise
- Menu
- Menu.FilterMenu
- Menu.Item
- Menu.PopupMenu
- Menu.Separator
- MenuButton
- MenuButton.Option
- MenuButton.Select
- MVC
- MVC.Collection
- MVC.Model
- MVC.Router
- MVC.View
- NodeList
- Overlay
- Overlay.Dialog
- Overlay.Popup
- Resizable
- Tree
- Tree.CheckNode
- Tree.CheckTree
- Tree.Node
- Waterfall
- Waterfall.Loader