Methods
(static) Serializable(usertypenullable)
- Source:
A class using this decorator is serializable. If usertype is not specified, objects from this class will be exported as QMap.
Examples
@Serializable('Network::Server')
export class Server {
@serialize(QString, {in: 'HostIn', out: 'HostOut'))
host;
@serialize(QUInt, 'Port')
port = 6667;
@serialize(QUInt)
sslVersion = 0;
constructor(args) {
this.blob = true; // will not be serialized at export
Object.assign(this, args);
}
}
@Serializable()
export class Server {
x = 12;
_export() {
return {
'a': this.x
};
}
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
usertype |
string |
<nullable> |
(static) serialize(qclass, serializekey)
- Source:
A class attribute using this decorator is serializable
Example
@Serializable()
export class Server {
@serialize(QString, {in: 'HostIn', out: 'HostOut'))
host;
@serialize(QUInt, 'Port')
port = 6667;
@serialize(QUInt)
sslVersion = 0;
constructor(args) {
Object.assign(this, args);
}
}
Parameters:
Name | Type | Description |
---|---|---|
qclass |
QClass | |
serializekey |
string | Object |