fune/devtools/shared/client/symbol-iterator-client.js
Victor Porof b8157dfaaf Bug 1561435 - Format remaining devtools/, a=automatic-formatting, CLOSED TREE
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35894

--HG--
extra : source : 4722b924e08478f5337ab509718bd66906bf472f
extra : amend_source : a5baa1aab21639fdba44537e3a10b179b0073cb4
2019-07-05 11:29:32 +02:00

73 lines
1.6 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {
arg,
DebuggerClient,
} = require("devtools/shared/client/debugger-client");
/**
* A SymbolIteratorClient provides a way to access to symbols
* of an object efficiently, slice by slice.
*
* @param client DebuggerClient
* The debugger client parent.
* @param grip Object
* A SymbolIteratorActor grip returned by the protocol via
* BrowsingContextTargetActor.enumSymbols request.
*/
function SymbolIteratorClient(client, grip) {
this._grip = grip;
this._client = client;
this.request = this._client.request;
}
SymbolIteratorClient.prototype = {
get actor() {
return this._grip.actor;
},
/**
* Get the total number of symbols available in the iterator.
*/
get count() {
return this._grip.count;
},
/**
* Get a set of following symbols.
*
* @param start Number
* The index of the first symbol to fetch.
* @param count Number
* The number of symbols to fetch.
* @param callback Function
* The function called when we receive the symbols.
*/
slice: DebuggerClient.requester(
{
type: "slice",
start: arg(0),
count: arg(1),
},
{}
),
/**
* Get all the symbols.
*
* @param callback Function
* The function called when we receive the symbols.
*/
all: DebuggerClient.requester(
{
type: "all",
},
{}
),
};
module.exports = SymbolIteratorClient;