gecko-dev/devtools/shared/client/symbol-iterator-client.js
J. Ryan Stinnett eaa4969e77 Bug 1172897 - Rename TabActor to BrowsingContextTargetActor. r=ochameau
MozReview-Commit-ID: LPTEx2h4F1o

--HG--
rename : devtools/server/actors/tab.js => devtools/server/actors/targets/browsing-context.js
rename : devtools/shared/specs/tab.js => devtools/shared/specs/targets/browsing-context.js
extra : rebase_source : e62720693ad492cdfb68ab21af1f54d78e85123a
2018-05-25 18:20:28 -05:00

65 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;