Mon 21 Jul 22:43:21 CEST 2025
This commit is contained in:
parent
a6dfe0ccf9
commit
024f6e1a87
36
js/x11/examples/simple/lsatomsp.js
Normal file
36
js/x11/examples/simple/lsatomsp.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
var x11 = require('../../lib');
|
||||||
|
x11.createClient(function(err, display) {
|
||||||
|
var maxstd = 0;
|
||||||
|
var atomName;
|
||||||
|
for (atomName in display.client.atoms)
|
||||||
|
{
|
||||||
|
var id = display.client.atoms[atomName];
|
||||||
|
console.log(id + '\t' + atomName);
|
||||||
|
if (id > maxstd)
|
||||||
|
maxstd = id;
|
||||||
|
}
|
||||||
|
(
|
||||||
|
function getAtoms(atomIdStart, atomIdEnd)
|
||||||
|
{
|
||||||
|
var atomId;
|
||||||
|
var numInBatch = atomIdEnd - atomIdStart;
|
||||||
|
for (atomId = atomIdStart; atomId < atomIdEnd; atomId++)
|
||||||
|
{
|
||||||
|
(function(id) {
|
||||||
|
display.client.GetAtomName(id, function(err, atom) {
|
||||||
|
if (err) {
|
||||||
|
display.client.terminate();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
console.log(id + '\t' + atom);
|
||||||
|
numInBatch--;
|
||||||
|
if (numInBatch === 0) {
|
||||||
|
getAtoms(atomIdStart + 100, atomIdEnd+ 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})(atomId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)(maxstd+1, maxstd+100);
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user