nsIStructuredCloneContainer 编辑

dom/interfaces/base/nsIStructuredCloneContainer.idlScriptable This interface acts as a container for an object serialized using the structured clone algorithm. 1.0 66 Introduced Gecko 6.0 Inherits from: nsISupports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3)

You can copy an object into an nsIStructuredCloneContainer using initFromVariant() or initFromBase64(). it is an error to initialize an nsIStructuredCloneContainer more than once.

Once you've initialized the container, you can get a copy of the object it stores by calling deserializeToVariant(). You can also get a base-64-encoded string containing a copy of the container's serialized data, using getDataAsBase64().

Method overview

nsIVariant deserializeToVariant();
AString getDataAsBase64();
void initFromBase64(in AString aData,in unsigned long aFormatVersion);
void initFromVariant(in nsIVariant aData);

Attributes

AttributeTypeDescription
formatVersionunsigned longGet the version of the structured clone algorithm which was used to generate this container's serialized buffer. Read only.
serializedNBytesunsigned long longGet the size in bytes of this container's serialized data. Read only.

Methods

deserializeToVariant()

Deserialize the object this container holds, returning it wrapped as an nsIVariant.

nsIVariant deserializeToVariant();
Parameters

None.

Return value

An nsIVariant.

getDataAsBase64()

Get this structured clone container's data as a base-64-encoded string.

AString getDataAsBase64();
Parameters

None.

Return value

A base-64-encoded string.

initFromBase64()

Initialize this structured clone container from a base-64-encoded byte stream.

void initFromBase64(
  in AString aData,
  in unsigned long aFormatVersion
);
Parameters
aData
A base-64-encoded byte stream.
aFormatVersion
The version of the structured clone algorithm which was used to generate aData.

initFromVariant()

Initialize this structured clone container so it contains a clone of the given variant.

void initFromVariant(
  in nsIVariant aData
);
Parameters
aData
A nsIVariant, must be backed by a jsval.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:104 次

字数:5439

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文