Global

Members

Object

# listeners

ตัวแปรสำหรับการเก็บข้อมูล listener จากฝั่ง client

View Source xnets.js, line 14

Object

# renderers

ตัวแปรสำหรับการเก็บข้อมูล state re-render

View Source xnets.js, line 9

Object

# states

ตัวแปรสำหรับการเก็บข้อมูล states

View Source xnets.js, line 4

Methods

# addFunction(name, cb)

ฟังก์ชั่นสำหรับการเพิ่มฟังก์ชั่นในฝั่งของ `Xnets Client` ทำขึ้นมาเพื่อใช้งานกับ `Attribute` `data-xnets-click`
Parameters:
Name Type Description
name string ชื่อฟังก์ชั่นที่คุณต้องการตั้ง
cb function เป็นฟังก์ชั่นที่จะถูกเรียกใช้เมื่อมีการเรียกใช้

View Source xnets.js, line 88

void

# addFunctions(list)

ฟังก์ชั่นสำหรับการเพิ่มฟังก์ชั่นในฝั่งของ `Xnets Client` ทำขึ้นมาเพื่อใช้งานกับ `Attribute` `data-xnets-click`
Parameters:
Name Type Description
list Array.<XnetsAddFunction> รวมฟังก์ชั่นที่ต้องการสร้างเพิ่มมาเพิ่มในฟังก์ชั่นเดียว

View Source xnets.js, line 104

void

# addListener(type, cb)

เพิ่ม `Listener` ในการติดต่อสื่อสารกับฝั่ง `Client` ของตัวเกม
Parameters:
Name Type Description
type string ประเภทของ `Event` ที่ต้องการสื่อสารกับฝั่ง `Client`
cb function ฟังก์ชั่นที่จะเรียกใช้

View Source xnets.js, line 171

void

# communicate(endpoint, datanullable)

ฟังก์ชั่นสำหรับการส่งข้อมูลจาก `Javascript` ไปยังฝั่ง `Client` หรือ **ผู้เล่น**
Parameters:
Name Type Attributes Description
endpoint string URL ของ Script ที่จะทำการสื่อสารเช่น `https://xnets/check `
data Object <nullable>
ข้อมูลที่จะทำการส่งคืนกลับไปให้ `Client`

View Source xnets.js, line 185

# getStateValue(name)

เป็นฟังก์ชั่นที่สร้างขึ้นมาเพื่อรองรับในการใช้ `Attribute` **show-on** เนื่องจาก Parameter แรกคือชื่อของ State และส่วนที่สองคือ Operator ในการตรวจสอบ และส่วนสุดท้ายคือข้อมูล ซึ่งเราสามารถเรียกใช้ฟังก์ชั่น `getStateValue` ในการดึง State มาตรวจสอบด้วยกันได้
Parameters:
Name Type Description
name string ชื่อของ State ที่คุณต้องการเรียกใช้

View Source xnets.js, line 43

void
Example
<div show-on="counter equal getStateValue('counter2')">
จากตัวอย่างเป็นการตรวจสอบ State counter และ State counter2 ว่ามีจำนวนเท่ากันหรือไม่

# queryStatement(name)

ฟังก์ชั่นสำหรับการตรวจสอบเงื่อนไข `Attribute` **show-on** เมื่อมีการเปลี่ยนแปลงค่า State บนเว็บไซต์ เพื่อให้มีการ `Re-Render Component` แบบ Real-Time ณ ขณะนั้น
Parameters:
Name Type Description
name string ชื่อของ State ที่ต้องการเช็ค

View Source xnets.js, line 56

void

# rerender(name, value)

ฟังก์ชั่นที่ใช้สำหรับการ `Render` หน้าเว็บเมื่อมีการอัพเดต `State` หนึ่งครั้ง
Parameters:
Name Type Description
name string ชื่อของ State ที่สร้างเมื่อใช้งานฟังก์ชั่น useState
value any ค่าของ State ที่จะเปลี่ยนบนหน้าเว็บไซต์

View Source xnets.js, line 28

void

# useState(defValue, namenullable) → {XnetsState}

ฟังก์ชั่นสำหรับการใช้งาน State | State คือตัวแปรที่เมื่อไหร่ที่ถูกเปลี่ยนแปลง หน้าเว็บไซต์จะมีการอัพเดตทันทีในรูปแบบ Real-Time
Parameters:
Name Type Attributes Description
defValue any ค่าเริ่มต้นของ State นั้น ๆ
name string <nullable>
กำหนดชื่อเพื่อใช้งานคู่กับ `Xnets Ref`

View Source xnets.js, line 123

XnetsState

Type Definitions

Object

# XnetsAddFunction

Properties:
Name Type Description
name string ชื่อฟังก์ชั่นที่คุณต้องการตั้ง
execute function เป็นฟังก์ชั่นที่จะถูกเรียกใช้เมื่อมีการเรียกใช้

View Source xnets.js, line 92

# XnetsState

Properties:
Name Type Description
value any ค่าเริ่มต้นที่คุณตั้งจากการใช้ `useState`
setter function ฟังก์ชั่นสำหรับเปลี่ยนแปลงค่า State

View Source xnets.js, line 110