API Docs for: TWaver HTML5 5.7.5
Show:

twaver.List Class

列表对象

这是一个集合类,封装了数组对象,增加了更加人性化的接口,方便对数据进行查改增删等操作

Constructor

twaver.List

() twaver.List

Returns:

Methods

twaver.List.add

(
  • item
  • [index]
)
Number

在指定的序号上添加一个子项

Parameters:

  • item Object

    添加的数据对象

  • [index] Number optional

    添加的数据对象的序号,如果序号为空,则添加在队列的最后一个位置

Returns:

Number:

返回list的长度

twaver.List.addAll

(
  • array
)

在列表的末尾添加多个元素,并返回它的长度

Parameters:

  • array Object

    添加的子项

twaver.List.clear

() Array

清空列表中的内容

Returns:

Array:

返回含有被删除的元素的数组

twaver.List.contains

(
  • item
)
Boolean

判断列表中是否包含指定的项

Parameters:

  • item Object

    指定的子项

Returns:

Boolean:

true为包含,否则为false

twaver.List.forEach

(
  • f
  • [scope]
)

循环遍历列表中所有的数据

Parameters:

  • f Function

    遍历时的回调函数

  • [scope] Object optional

    回调函数的作用域,为空时,指的是window

twaver.List.forEachReverse

(
  • f
  • [scope]
)

反向循环遍历列表中所有的数据

Parameters:

  • f Function

    遍历时的回调函数

  • [scope] Object optional

    回调函数的作用域,为空时,指的是window

twaver.List.get

(
  • index
)
Object

获取指定序号上的数据项

Parameters:

  • index Number

    指定的序号

Returns:

Object:

指定序号上的数据项

twaver.List.getClassName

() String

获取类的名称

Returns:

String:

类名

twaver.List.indexOf

(
  • item
)
String

Parameters:

  • item String

Returns:

String:

twaver.List.isEmpty

() Boolean

判断列表是否为空

Returns:

Boolean:

如果为空返回true,否则返回false

twaver.List.remove

(
  • item
)
Number

移除列表上指定的项

Parameters:

  • item Object

    移除的列表项

Returns:

Number:

数据项的序号

twaver.List.removeAt

(
  • index
)
String

移除列表上指定的序号上的数据项

Parameters:

  • index Number

    指定的序号值

Returns:

String:

twaver.List.set

(
  • index
  • item
)
String

给指定的序号上设置数据项

Parameters:

  • index Number

    指定的序号值

  • item Object

    指定的数据项

Returns:

String:

twaver.List.size

() Number

列表的长度

Returns:

Number:

列表的长度

twaver.List.sort

(
  • [sortFunction]
)
twaver.List

按照指定的排序方法排序

Parameters:

  • [sortFunction] Function optional

    可选,排序的函数

Returns:

twaver.List.toArray

(
  • matchFunction
  • [scope]
)
Array

根据指定的函数将列表转成数组

Parameters:

  • matchFunction Function

    转化时的条件函数

  • [scope] Object optional

    条件函数的作用域,为空时指的是window

Returns:

Array:

twaver.List.toList

(
  • matchFunction
  • scope
)
String

Parameters:

  • matchFunction String
  • scope String

Returns:

String: