Skip to content

class_extensions

j-show edited this page Mar 1, 2019 · 1 revision

Extend the basic class structure and improve the mechanism of event and exception handling

TObject

  • Note
    • Based on the ES6 specification, the underlying class is generated
    • Extended exception handling mechanism
    • Extended Event Mount processing mechanism
  • Class Function
    • create()
      • Note
        • Class object Initialization
      • Return
        • object
  • Object Function
    • free()
      • Note
        • Class object Release
    • on(key, func)
      • Note
        • Event bind
      • Parameters
        • key Event name
        • func Event function
      • Return
        • this
    • off([key], [func])
      • Note
        • Event unbind
      • Parameters
        • key Event name
        • func Event function
          • When Func is not empty, the key event is traversed to remove a specific callback function
          • Delete all key events when Func is empty
        • Delete all binding events when parameters is empty
      • Return
        • this
    • async call(key, [arg...])
      • Note
        • Triggers an event that is handled in a await manner when the callback content contains an asynchronous function
      • Parameters
        • key Event name
        • arg When an event is triggered, the parameter is substituting
      • Return
        • this
    • getError(index)
      • Note
        • Get error messages
      • Parameters
        • index Error Record index
      • Return
        • {level,code,msg} Error message object
          • level Error level,log/info/error
          • code Error code
          • msg Error message
    • setError(level, code, msg)
      • Note
        • Set up error messages and trigger the error event
      • Parameters
        • level Error level,log/info/error
        • code Error code
        • msg Error message
      • Return
        • {level,code,msg} Error message object
          • level Error level,log/info/error
          • code Error code
          • msg Error message
    • clearError()
      • Note
        • Clear error message object list
      • Return
        • this
  • Property
    • className
      • Note
        • Class name, subsequent all subclasses need to be overwritten with their own class name
          • By rewriting __className in the constructor function
      • Readonly
      • Return
        • string
    • errorMax
      • Note
        • Error Record maximum value
      • Read & Write
      • Return
        • number
    • lastError
      • Note
        • Last Error logging
      • Readonly
      • Return
        • {level,code,msg} Error message object
          • level Error level,log/info/error
          • code Error code
          • msg Error message

TSeal

  • Note
    • The underlying class that is generated in the form of a function mount
    • Extended exception handling mechanism,with TObject
    • Extended event mount processing mechanism, with TObject
  • Class Function
    • extend(childAPI)
      • Note
        • Inherit with Childapi as a subkey (deep copy mode))
      • Parameters
        • childAPI API Collection Objects
      • Return
        • class function
  • Object Function
    • clone()
      • Note
        • Copy the class object itself, including the property content and status of the currently changed

TCache

  • Note
    • Cache processing classes that recycle caches based on buffer objects
    • Inherited from TObject
  • Class Function
    • alloc([max=128])
      • Note
        • Create TCache object
      • Parameters
        • max cache max size
      • Return
        • Return TCache object
  • Object Function
    • valueOf()
      • Note
        • Object Real Value,Buffer object
      • Return
        • Return Buffer object
    • resize([force=false])
      • Note
        • Adjust cached data block locations, similar to memory collation
      • Parameters
        • force=false Whether to force memory collation
          • force=false,Detects the presence of data and moves the block position to the cache header, idle out of the unused area of the tail
      • Return
        • Return Remaining space size
    • clear()
      • Note
        • Clear cache object
      • Return
        • Return TCache object
    • push(buf)
      • Note
        • Populate data
      • Parameters
        • buf Populate target data, buffer objects
      • Return
        • Return TCache object
    • remove(size)
      • Note
        • Delete data and delete from the header of available data
      • Parameters
        • size Delete the number of data
      • Return
        • Return TCache object
  • Property
    • max
      • Note
        • Cache size, Unit bytes
      • Readonly
      • Return
        • number
    • index
      • Note
        • Data Start location
      • Readonly
      • Return
        • number
    • length
      • Note
        • Data size, Unit bytes
      • Readonly
      • Return
        • number
    • offset
      • Note
        • Available Cache start position
      • Readonly
      • Return
        • number
    • surplus
      • Note
        • Available Cache Size
      • Readonly
      • Return
        • number

TList

  • Note
    • Queue processing base classes that extend queues based on array objects
    • Derived queue, stack, generic queue, generic stack and other extended forms
    • Inherited from TObject

TChinaDate

  • Note
    • Lunar Time processing class, conversion calculation of time based on date object
    • Calculation of Tiangan, support, throttle and five lines related to the lunar calendar
    • Inherited from TObject
  • Class Function
    • toString([fmt], [date])
      • Note
        • Time-to-turn string display
      • Parameters
        • fmt=Y年(Z) M月 D T String conversion format
          • Convert the toString function of the format with the TChinaDate object
        • date Date object that needs to be converted, the default is the current time
      • Return
        • Return string
  • Object Function
    • valueOf()
      • Note
        • Object Real Value
      • Return
        • Return number,getTime() of the built-in date object
    • getTime()
      • Note
        • Get the number of milliseconds for the current time
      • Return
        • Return number
    • setTime(dt)
      • Note
        • Set the current time to dt
      • Parameters
        • dt Target time
          • dt is number,Set the time as a millisecond
          • dt is Date object,Set the time as date
      • Return
        • Return this
    • toString([fmt])
      • Note
        • Convert the current time to a string in fmt format
      • Parameters
        • fmt=Y年(Z) M月 D T String conversion format
          • CY Chinese Year
          • CM Chinese Month
          • CD Chinese Day
          • Y Year
          • M Month
          • D Day
          • T 24 Term
          • Z Zodiac
      • Return
        • Return string
  • Property
    • Year
      • Note
        • Year
      • Readonly
      • Return
        • string
    • Month
      • Note
        • Month
      • Readonly
      • Return
        • string
    • Day
      • Note
        • Day
      • Readonly
      • Return
        • string
    • CYear
      • Note
        • Chinese Year
      • Readonly
      • Return
        • string
    • CMonth
      • Note
        • Chinese Month
      • Readonly
      • Return
        • string
    • CDay
      • Note
        • Chinese Day
      • Readonly
      • Return
        • string
    • Term
      • Note
        • Term
      • Readonly
      • Return
        • string
    • Zodiac
      • Note
        • Zodiac
      • Readonly
      • Return
        • string
    • IsLeapYear
      • Note
        • Whether the current year is a lunar leap years
      • Readonly
      • Return
        • string

TGuid

  • Note
    • GUID conversion class, unable to generate real GUID through hardware information, can only simulate data
    • determination and conversion of GUID values
    • Inherited from TObject
  • Class Function
    • toString()
      • Note
        • Get the new GUID and converts it into a string
      • Return
        • Return string
    • toByteArray()
      • Note
        • Get the new GUID and converts it into a byte array
      • Return
        • Return array
    • New()
      • Note
        • Get the new GUID
      • Return
        • Return TGuid object
  • Object Function
    • valueOf()
      • Note
        • Object True value, similar to calling toString()
      • Return
        • Return string
    • toString()
      • Note
        • Convert to String
      • Return
        • Return string
    • toByteArray()
      • Note
        • Convert to byte array
      • Return
        • Return array
    • New()
      • Note
        • Generate a new GUID, current this remains the same, replace the content
      • Return
        • Return this

List([type])

  • Note
    • Queue functions that can qualify queue types by type
  • Parameters
    • type Qualified type, which can be a string value of the type
  • Return
    • Return TList object

ChinaDate([dt])

  • Note
    • Lunar time function, based on Tchinadate object
    • Basic operation simulates the Date object
  • Parameters
    • dt Bring the time value as the current time, which can be Number type
  • Return
    • Return TChinaDate object

NewGuid()

  • Note
    • Generate GUID to generate GUID by simulating
    • GUID value is a random number that conforms to the rule and is hardware-independent
  • Return
    • Return TGuid object

EmptyGuid()

  • Note
    • Generate GUID to generate GUID by simulating
    • GUID value is 0
  • Return
    • Return TGuid object
Clone this wiki locally