GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing leancloud.github.io — Object - Documentation Constructornew Object(attributes, options)
Creates a new model with defined attributes. A client id (cid) is
automatically generated and assigned for you.
You won't normally call this method directly. It is recommended that
you use a subclass of However, if you don't want to use a subclass, or aren't sure which subclass is appropriate, you can use this form: var object = new AV.Object("ClassName");
That is basically equivalent to: var MyClass = AV.Object.extend("ClassName");
var object = new MyClass();
Parameters:
Members(static, readonly) query :AV.Query
Get a new Query of the current class
Type:Example
Methods(static) 'new'(attributes, options) → {AV.Object}
Creates a new model with defined attributes,
It's the same with
new AV.Object(attributes, options); Parameters:
Returns:
(static) createWithoutData(class, id) → {AV.Object}
Creates an instance of a subclass of AV.Object for the give classname
and id.
Parameters:
Returns:
A new subclass instance of AV.Object.
(static) destroyAll(objects, options) → {Promise}
Delete objects in batch.
Parameters:
Returns:
A promise that is fulfilled when the save
completes.
(static) extend(className, protoProps, classProps) → {Class}
Creates a new subclass of AV.Object for the given AV class name.
Every extension of a AV class will inherit from the most recent previous extension of that class. When a AV.Object is automatically created by parsing JSON, it will use the most recent extension of that class. Example
Parameters:
Returns:
A new subclass of AV.Object.
(static) fetchAll(objects, options) → {Promise.<Array.<AV.Object>>}
Fetch the given list of AV.Object.
Parameters:
Returns:
The given list of
AV.Object, updated
(static) register(klass, nameopt)
Register a class.
If a subclass of
AV.Object is defined with your own implement
rather then AV.Object.extend, the subclass must be registered.
Example
Parameters:
(static) saveAll(list)
Saves the given list of AV.Object.
If any error is encountered, stops and calls the error handler.
Example
Parameters:
add(key, item)
Atomically add an object to the end of the array associated with a given
key.
Parameters:
addUnique(key, item)
Atomically add an object to the array associated with a given key, only
if it is not already present in the array. The position of the insert is
not guaranteed.
Parameters:
bitAnd(key, value)
Atomically apply a "bit and" operation on the value associated with a
given key.
Parameters:
bitOr(key, value)
Atomically apply a "bit or" operation on the value associated with a
given key.
Parameters:
bitXor(key, value)
Atomically apply a "bit xor" operation on the value associated with a
given key.
Parameters:
change()
Call this method to manually fire a `"change"` event for this model and
a `"change:attribute"` event for each changed attribute.
Calling this will cause all objects observing the model to update.
clear()
Clear all attributes on the model, firing
"change" unless
you choose to silence it.
clone() → {AV.Object}
Creates a new model with identical attributes to this one.
Returns:
destroy(options) → {Promise}
Destroy this model on the server if it was already persisted.
Optimistically removes the model from its collection, if it has one.
Parameters:
Returns:
A promise that is fulfilled when the destroy
completes.
dirty(attr) → {Boolean}
Returns true if this object has been modified since its last
save/refresh. If an attribute is specified, it returns true only if that
particular attribute has been modified since the last save/refresh.
Parameters:
Returns:
dirtyKeys() → {Array.<String>}
Returns the keys of the modified attribute since its last save/refresh.
Returns:
escape()
Gets the HTML-escaped value of an attribute.
fetch(fetchOptions, options) → {Promise}
Fetch the model from the server. If the server's representation of the
model differs from its current attributes, they will be overriden,
triggering a
"change" event.
Parameters:
Returns:
A promise that is fulfilled when the fetch
completes.
fetchWhenSave(enable)
Set whether to enable fetchWhenSave option when updating object.
When set true, SDK would fetch the latest object after saving.
Default is false.
Parameters:
get(attr)
Gets the value of an attribute.
Parameters:
getACL() → {AV.ACL}
Returns the ACL for this object.
Returns:
An instance of AV.ACL.
getCreatedAt() → {Date}
Returns the object's createdAt attribute.
Returns:
getObjectId() → {String}
Returns the object's objectId.
Returns:
the objectId.
getUpdatedAt() → {Date}
Returns the object's updatedAt attribute.
Returns:
has(attr) → {Boolean}
Returns
true if the attribute contains a value that is not
null or undefined.
Parameters:
Returns:
increment(key, amount)
Atomically increments the value of the given attribute the next time the
object is saved. If no amount is specified, 1 is used by default.
Parameters:
initialize()
Initialize is an empty function by default. Override it with your own
initialization logic.
isNew() → {Boolean}
Returns true if this object has never been saved to AV.
Returns:
isValid() → {Boolean}
Checks if the model is currently in a valid state. It's only possible to
get into an *invalid* state if you're using silent changes.
Returns:
op(key) → {AV.Op}
Returns an instance of a subclass of AV.Op describing what kind of
modification has been performed on this field since the last time it was
saved. For example, after calling object.increment("x"), calling
object.op("x") would return an instance of AV.Op.Increment.
Parameters:
Returns:
The operation, or undefined if none.
previous(attr)
Gets the previous value of an attribute, recorded at the time the last
"change" event was fired.
Parameters:
previousAttributes() → {Object}
Gets all of the attributes of the model at the time of the previous
"change" event.
Returns:
relation(attr) → {AV.Relation}
Gets a relation on the given class for the attribute.
Parameters:
Returns:
remove(key, item)
Atomically remove all instances of an object from the array associated
with a given key.
Parameters:
revert(keysopt)
Clears any (or specific) changes to the model made since the last save.
Parameters:
save(options) → {Promise}
Set a hash of model attributes, and save the model to the server.
updatedAt will be updated when the request returns.
You can either call it as:
object.save();or object.save(null, options);or object.save(attrs, options);or object.save(key, value, options); Example
Parameters:
Returns:
A promise that is fulfilled when the save
completes.
set(key, value, optionsopt) → {AV.Object}
Sets a hash of model attributes on the object, firing
"change" unless you choose to silence it.
You can call it with an object containing keys and values, or with one key and value. For example: Example
Parameters:
Returns:
self if succeeded, throws if the value is not valid.
setACL(acl, options) → {AV.Object}
Sets the ACL to be used for this object.
Parameters:
Returns:
self
toFullJSON() → {Object}
Returns a JSON version of the object with meta data.
Inverse to AV.parseJSON
Returns:
toJSON() → {Object}
Returns a JSON version of the object.
Returns:
unset(key)
Remove an attribute from the model, firing
"change" unless
you choose to silence it. This is a noop if the attribute doesn't
exist.
Parameters:
validate(attrs)
You should not call this function directly unless you subclass
AV.Object, in which case you can override this method
to provide additional validation on set and
save. Your implementation should throw an Error if
the attrs is invalid
Parameters:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |