How to use operatorListChanged method in wpt

Best JavaScript code snippet using wpt

api.js

Source:api.js Github

copy

Full Screen

...697 return;698 }699 stats.time('Rendering');700 internalRenderTask.initalizeGraphics(transparency);701 internalRenderTask.operatorListChanged();702 },703 function pageDisplayReadPromiseError(reason) {704 complete(reason);705 }706 );707 function complete(error) {708 var i = intentState.renderTasks.indexOf(internalRenderTask);709 if (i >= 0) {710 intentState.renderTasks.splice(i, 1);711 }712 if (self.cleanupAfterRender) {713 self.pendingDestroy = true;714 }715 self._tryDestroy();716 if (error) {717 internalRenderTask.capability.reject(error);718 } else {719 internalRenderTask.capability.resolve();720 }721 stats.timeEnd('Rendering');722 stats.timeEnd('Overall');723 }724 return renderTask;725 },726 /**727 * @return {Promise} A promise resolved with an {@link PDFOperatorList}728 * object that represents page's operator list.729 */730 getOperatorList: function PDFPageProxy_getOperatorList() {731 function operatorListChanged() {732 if (intentState.operatorList.lastChunk) {733 intentState.opListReadCapability.resolve(intentState.operatorList);734 }735 }736 var renderingIntent = 'oplist';737 if (!this.intentStates[renderingIntent]) {738 this.intentStates[renderingIntent] = {};739 }740 var intentState = this.intentStates[renderingIntent];741 if (!intentState.opListReadCapability) {742 var opListTask = {};743 opListTask.operatorListChanged = operatorListChanged;744 intentState.receivingOperatorList = true;745 intentState.opListReadCapability = createPromiseCapability();746 intentState.renderTasks = [];747 intentState.renderTasks.push(opListTask);748 intentState.operatorList = {749 fnArray: [],750 argsArray: [],751 lastChunk: false752 };753 this.transport.messageHandler.send('RenderPageRequest', {754 pageIndex: this.pageIndex,755 intent: renderingIntent756 });757 }758 return intentState.opListReadCapability.promise;759 },760 /**761 * @return {Promise} That is resolved a {@link TextContent}762 * object that represent the page text content.763 */764 getTextContent: function PDFPageProxy_getTextContent() {765 return this.transport.messageHandler.sendWithPromise('GetTextContent', {766 pageIndex: this.pageNumber - 1767 });768 },769 /**770 * Destroys resources allocated by the page.771 */772 destroy: function PDFPageProxy_destroy() {773 this.pendingDestroy = true;774 this._tryDestroy();775 },776 /**777 * For internal use only. Attempts to clean up if rendering is in a state778 * where that's possible.779 * @ignore780 */781 _tryDestroy: function PDFPageProxy__destroy() {782 if (!this.pendingDestroy ||783 Object.keys(this.intentStates).some(function(intent) {784 var intentState = this.intentStates[intent];785 return (intentState.renderTasks.length !== 0 ||786 intentState.receivingOperatorList);787 }, this)) {788 return;789 }790 Object.keys(this.intentStates).forEach(function(intent) {791 delete this.intentStates[intent];792 }, this);793 this.objs.clear();794 this.annotationsPromise = null;795 this.pendingDestroy = false;796 },797 /**798 * For internal use only.799 * @ignore800 */801 _startRenderPage: function PDFPageProxy_startRenderPage(transparency,802 intent) {803 var intentState = this.intentStates[intent];804 // TODO Refactor RenderPageRequest to separate rendering805 // and operator list logic806 if (intentState.displayReadyCapability) {807 intentState.displayReadyCapability.resolve(transparency);808 }809 },810 /**811 * For internal use only.812 * @ignore813 */814 _renderPageChunk: function PDFPageProxy_renderPageChunk(operatorListChunk,815 intent) {816 var intentState = this.intentStates[intent];817 var i, ii;818 // Add the new chunk to the current operator list.819 for (i = 0, ii = operatorListChunk.length; i < ii; i++) {820 intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);821 intentState.operatorList.argsArray.push(822 operatorListChunk.argsArray[i]);823 }824 intentState.operatorList.lastChunk = operatorListChunk.lastChunk;825 // Notify all the rendering tasks there are more operators to be consumed.826 for (i = 0; i < intentState.renderTasks.length; i++) {827 intentState.renderTasks[i].operatorListChanged();828 }829 if (operatorListChunk.lastChunk) {830 intentState.receivingOperatorList = false;831 this._tryDestroy();832 }833 }834 };835 return PDFPageProxy;836})();837/**838 * For internal use only.839 * @ignore840 */841var WorkerTransport = (function WorkerTransportClosure() {842 function WorkerTransport(workerInitializedCapability, pdfDataRangeTransport) {843 this.pdfDataRangeTransport = pdfDataRangeTransport;844 this.workerInitializedCapability = workerInitializedCapability;845 this.commonObjs = new PDFObjects();846 this.loadingTask = null;847 this.pageCache = [];848 this.pagePromises = [];849 this.downloadInfoCapability = createPromiseCapability();850 // If worker support isn't disabled explicit and the browser has worker851 // support, create a new web worker and test if it/the browser fullfills852 // all requirements to run parts of pdf.js in a web worker.853 // Right now, the requirement is, that an Uint8Array is still an Uint8Array854 // as it arrives on the worker. Chrome added this with version 15.855//#if !SINGLE_FILE856 if (!globalScope.PDFJS.disableWorker && typeof Worker !== 'undefined') {857 var workerSrc = PDFJS.workerSrc;858 if (!workerSrc) {859 error('No PDFJS.workerSrc specified');860 }861 try {862 // Some versions of FF can't create a worker on localhost, see:863 // https://bugzilla.mozilla.org/show_bug.cgi?id=683280864 var worker = new Worker(workerSrc);865 var messageHandler = new MessageHandler('main', worker);866 this.messageHandler = messageHandler;867 messageHandler.on('test', function transportTest(data) {868 var supportTypedArray = data && data.supportTypedArray;869 if (supportTypedArray) {870 this.worker = worker;871 if (!data.supportTransfers) {872 PDFJS.postMessageTransfers = false;873 }874 this.setupMessageHandler(messageHandler);875 workerInitializedCapability.resolve();876 } else {877 this.setupFakeWorker();878 }879 }.bind(this));880 var testObj = new Uint8Array([PDFJS.postMessageTransfers ? 255 : 0]);881 // Some versions of Opera throw a DATA_CLONE_ERR on serializing the882 // typed array. Also, checking if we can use transfers.883 try {884 messageHandler.send('test', testObj, [testObj.buffer]);885 } catch (ex) {886 info('Cannot use postMessage transfers');887 testObj[0] = 0;888 messageHandler.send('test', testObj);889 }890 return;891 } catch (e) {892 info('The worker has been disabled.');893 }894 }895//#endif896 // Either workers are disabled, not supported or have thrown an exception.897 // Thus, we fallback to a faked worker.898 this.setupFakeWorker();899 }900 WorkerTransport.prototype = {901 destroy: function WorkerTransport_destroy() {902 this.pageCache = [];903 this.pagePromises = [];904 var self = this;905 this.messageHandler.sendWithPromise('Terminate', null).then(function () {906 FontLoader.clear();907 if (self.worker) {908 self.worker.terminate();909 }910 });911 },912 setupFakeWorker: function WorkerTransport_setupFakeWorker() {913 globalScope.PDFJS.disableWorker = true;914 if (!PDFJS.fakeWorkerFilesLoadedCapability) {915 PDFJS.fakeWorkerFilesLoadedCapability = createPromiseCapability();916 // In the developer build load worker_loader which in turn loads all the917 // other files and resolves the promise. In production only the918 // pdf.worker.js file is needed.919//#if !PRODUCTION920 Util.loadScript(PDFJS.workerSrc);921//#endif922//#if PRODUCTION && SINGLE_FILE923// PDFJS.fakeWorkerFilesLoadedCapability.resolve();924//#endif925//#if PRODUCTION && !SINGLE_FILE926// Util.loadScript(PDFJS.workerSrc, function() {927// PDFJS.fakeWorkerFilesLoadedCapability.resolve();928// });929//#endif930 }931 PDFJS.fakeWorkerFilesLoadedCapability.promise.then(function () {932 warn('Setting up fake worker.');933 // If we don't use a worker, just post/sendMessage to the main thread.934 var fakeWorker = {935 postMessage: function WorkerTransport_postMessage(obj) {936 fakeWorker.onmessage({data: obj});937 },938 terminate: function WorkerTransport_terminate() {}939 };940 var messageHandler = new MessageHandler('main', fakeWorker);941 this.setupMessageHandler(messageHandler);942 // If the main thread is our worker, setup the handling for the messages943 // the main thread sends to it self.944 PDFJS.WorkerMessageHandler.setup(messageHandler);945 this.workerInitializedCapability.resolve();946 }.bind(this));947 },948 setupMessageHandler:949 function WorkerTransport_setupMessageHandler(messageHandler) {950 this.messageHandler = messageHandler;951 function updatePassword(password) {952 messageHandler.send('UpdatePassword', password);953 }954 var pdfDataRangeTransport = this.pdfDataRangeTransport;955 if (pdfDataRangeTransport) {956 pdfDataRangeTransport.addRangeListener(function(begin, chunk) {957 messageHandler.send('OnDataRange', {958 begin: begin,959 chunk: chunk960 });961 });962 pdfDataRangeTransport.addProgressListener(function(loaded) {963 messageHandler.send('OnDataProgress', {964 loaded: loaded965 });966 });967 pdfDataRangeTransport.addProgressiveReadListener(function(chunk) {968 messageHandler.send('OnDataRange', {969 chunk: chunk970 });971 });972 messageHandler.on('RequestDataRange',973 function transportDataRange(data) {974 pdfDataRangeTransport.requestDataRange(data.begin, data.end);975 }, this);976 }977 messageHandler.on('GetDoc', function transportDoc(data) {978 var pdfInfo = data.pdfInfo;979 this.numPages = data.pdfInfo.numPages;980 var pdfDocument = new PDFDocumentProxy(pdfInfo, this);981 this.pdfDocument = pdfDocument;982 this.loadingTask._capability.resolve(pdfDocument);983 }, this);984 messageHandler.on('NeedPassword',985 function transportNeedPassword(exception) {986 var loadingTask = this.loadingTask;987 if (loadingTask.onPassword) {988 return loadingTask.onPassword(updatePassword,989 PasswordResponses.NEED_PASSWORD);990 }991 loadingTask._capability.reject(992 new PasswordException(exception.message, exception.code));993 }, this);994 messageHandler.on('IncorrectPassword',995 function transportIncorrectPassword(exception) {996 var loadingTask = this.loadingTask;997 if (loadingTask.onPassword) {998 return loadingTask.onPassword(updatePassword,999 PasswordResponses.INCORRECT_PASSWORD);1000 }1001 loadingTask._capability.reject(1002 new PasswordException(exception.message, exception.code));1003 }, this);1004 messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {1005 this.loadingTask._capability.reject(1006 new InvalidPDFException(exception.message));1007 }, this);1008 messageHandler.on('MissingPDF', function transportMissingPDF(exception) {1009 this.loadingTask._capability.reject(1010 new MissingPDFException(exception.message));1011 }, this);1012 messageHandler.on('UnexpectedResponse',1013 function transportUnexpectedResponse(exception) {1014 this.loadingTask._capability.reject(1015 new UnexpectedResponseException(exception.message, exception.status));1016 }, this);1017 messageHandler.on('UnknownError',1018 function transportUnknownError(exception) {1019 this.loadingTask._capability.reject(1020 new UnknownErrorException(exception.message, exception.details));1021 }, this);1022 messageHandler.on('DataLoaded', function transportPage(data) {1023 this.downloadInfoCapability.resolve(data);1024 }, this);1025 messageHandler.on('PDFManagerReady', function transportPage(data) {1026 if (this.pdfDataRangeTransport) {1027 this.pdfDataRangeTransport.transportReady();1028 }1029 }, this);1030 messageHandler.on('StartRenderPage', function transportRender(data) {1031 var page = this.pageCache[data.pageIndex];1032 page.stats.timeEnd('Page Request');1033 page._startRenderPage(data.transparency, data.intent);1034 }, this);1035 messageHandler.on('RenderPageChunk', function transportRender(data) {1036 var page = this.pageCache[data.pageIndex];1037 page._renderPageChunk(data.operatorList, data.intent);1038 }, this);1039 messageHandler.on('commonobj', function transportObj(data) {1040 var id = data[0];1041 var type = data[1];1042 if (this.commonObjs.hasData(id)) {1043 return;1044 }1045 switch (type) {1046 case 'Font':1047 var exportedData = data[2];1048 var font;1049 if ('error' in exportedData) {1050 var error = exportedData.error;1051 warn('Error during font loading: ' + error);1052 this.commonObjs.resolve(id, error);1053 break;1054 } else {1055 font = new FontFaceObject(exportedData);1056 }1057 FontLoader.bind(1058 [font],1059 function fontReady(fontObjs) {1060 this.commonObjs.resolve(id, font);1061 }.bind(this)1062 );1063 break;1064 case 'FontPath':1065 this.commonObjs.resolve(id, data[2]);1066 break;1067 default:1068 error('Got unknown common object type ' + type);1069 }1070 }, this);1071 messageHandler.on('obj', function transportObj(data) {1072 var id = data[0];1073 var pageIndex = data[1];1074 var type = data[2];1075 var pageProxy = this.pageCache[pageIndex];1076 var imageData;1077 if (pageProxy.objs.hasData(id)) {1078 return;1079 }1080 switch (type) {1081 case 'JpegStream':1082 imageData = data[3];1083 loadJpegStream(id, imageData, pageProxy.objs);1084 break;1085 case 'Image':1086 imageData = data[3];1087 pageProxy.objs.resolve(id, imageData);1088 // heuristics that will allow not to store large data1089 var MAX_IMAGE_SIZE_TO_STORE = 8000000;1090 if (imageData && 'data' in imageData &&1091 imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) {1092 pageProxy.cleanupAfterRender = true;1093 }1094 break;1095 default:1096 error('Got unknown object type ' + type);1097 }1098 }, this);1099 messageHandler.on('DocProgress', function transportDocProgress(data) {1100 var loadingTask = this.loadingTask;1101 if (loadingTask.onProgress) {1102 loadingTask.onProgress({1103 loaded: data.loaded,1104 total: data.total1105 });1106 }1107 }, this);1108 messageHandler.on('PageError', function transportError(data) {1109 var page = this.pageCache[data.pageNum - 1];1110 var intentState = page.intentStates[data.intent];1111 if (intentState.displayReadyCapability) {1112 intentState.displayReadyCapability.reject(data.error);1113 } else {1114 error(data.error);1115 }1116 }, this);1117 messageHandler.on('JpegDecode', function(data) {1118 var imageUrl = data[0];1119 var components = data[1];1120 if (components !== 3 && components !== 1) {1121 return Promise.reject(1122 new Error('Only 3 components or 1 component can be returned'));1123 }1124 return new Promise(function (resolve, reject) {1125 var img = new Image();1126 img.onload = function () {1127 var width = img.width;1128 var height = img.height;1129 var size = width * height;1130 var rgbaLength = size * 4;1131 var buf = new Uint8Array(size * components);1132 var tmpCanvas = createScratchCanvas(width, height);1133 var tmpCtx = tmpCanvas.getContext('2d');1134 tmpCtx.drawImage(img, 0, 0);1135 var data = tmpCtx.getImageData(0, 0, width, height).data;1136 var i, j;1137 if (components === 3) {1138 for (i = 0, j = 0; i < rgbaLength; i += 4, j += 3) {1139 buf[j] = data[i];1140 buf[j + 1] = data[i + 1];1141 buf[j + 2] = data[i + 2];1142 }1143 } else if (components === 1) {1144 for (i = 0, j = 0; i < rgbaLength; i += 4, j++) {1145 buf[j] = data[i];1146 }1147 }1148 resolve({ data: buf, width: width, height: height});1149 };1150 img.onerror = function () {1151 reject(new Error('JpegDecode failed to load image'));1152 };1153 img.src = imageUrl;1154 });1155 });1156 },1157 fetchDocument: function WorkerTransport_fetchDocument(loadingTask, source) {1158 this.loadingTask = loadingTask;1159 source.disableAutoFetch = PDFJS.disableAutoFetch;1160 source.disableStream = PDFJS.disableStream;1161 source.chunkedViewerLoading = !!this.pdfDataRangeTransport;1162 if (this.pdfDataRangeTransport) {1163 source.length = this.pdfDataRangeTransport.length;1164 source.initialData = this.pdfDataRangeTransport.initialData;1165 }1166 this.messageHandler.send('GetDocRequest', {1167 source: source,1168 disableRange: PDFJS.disableRange,1169 maxImageSize: PDFJS.maxImageSize,1170 cMapUrl: PDFJS.cMapUrl,1171 cMapPacked: PDFJS.cMapPacked,1172 disableFontFace: PDFJS.disableFontFace,1173 disableCreateObjectURL: PDFJS.disableCreateObjectURL,1174 verbosity: PDFJS.verbosity1175 });1176 },1177 getData: function WorkerTransport_getData() {1178 return this.messageHandler.sendWithPromise('GetData', null);1179 },1180 getPage: function WorkerTransport_getPage(pageNumber, capability) {1181 if (pageNumber <= 0 || pageNumber > this.numPages ||1182 (pageNumber|0) !== pageNumber) {1183 return Promise.reject(new Error('Invalid page request'));1184 }1185 var pageIndex = pageNumber - 1;1186 if (pageIndex in this.pagePromises) {1187 return this.pagePromises[pageIndex];1188 }1189 var promise = this.messageHandler.sendWithPromise('GetPage', {1190 pageIndex: pageIndex1191 }).then(function (pageInfo) {1192 var page = new PDFPageProxy(pageIndex, pageInfo, this);1193 this.pageCache[pageIndex] = page;1194 return page;1195 }.bind(this));1196 this.pagePromises[pageIndex] = promise;1197 return promise;1198 },1199 getPageIndex: function WorkerTransport_getPageIndexByRef(ref) {1200 return this.messageHandler.sendWithPromise('GetPageIndex', { ref: ref });1201 },1202 getAnnotations: function WorkerTransport_getAnnotations(pageIndex) {1203 return this.messageHandler.sendWithPromise('GetAnnotations',1204 { pageIndex: pageIndex });1205 },1206 getDestinations: function WorkerTransport_getDestinations() {1207 return this.messageHandler.sendWithPromise('GetDestinations', null);1208 },1209 getDestination: function WorkerTransport_getDestination(id) {1210 return this.messageHandler.sendWithPromise('GetDestination', { id: id } );1211 },1212 getAttachments: function WorkerTransport_getAttachments() {1213 return this.messageHandler.sendWithPromise('GetAttachments', null);1214 },1215 getJavaScript: function WorkerTransport_getJavaScript() {1216 return this.messageHandler.sendWithPromise('GetJavaScript', null);1217 },1218 getOutline: function WorkerTransport_getOutline() {1219 return this.messageHandler.sendWithPromise('GetOutline', null);1220 },1221 getMetadata: function WorkerTransport_getMetadata() {1222 return this.messageHandler.sendWithPromise('GetMetadata', null).1223 then(function transportMetadata(results) {1224 return {1225 info: results[0],1226 metadata: (results[1] ? new PDFJS.Metadata(results[1]) : null)1227 };1228 });1229 },1230 getStats: function WorkerTransport_getStats() {1231 return this.messageHandler.sendWithPromise('GetStats', null);1232 },1233 startCleanup: function WorkerTransport_startCleanup() {1234 this.messageHandler.sendWithPromise('Cleanup', null).1235 then(function endCleanup() {1236 for (var i = 0, ii = this.pageCache.length; i < ii; i++) {1237 var page = this.pageCache[i];1238 if (page) {1239 page.destroy();1240 }1241 }1242 this.commonObjs.clear();1243 FontLoader.clear();1244 }.bind(this));1245 }1246 };1247 return WorkerTransport;1248})();1249/**1250 * A PDF document and page is built of many objects. E.g. there are objects1251 * for fonts, images, rendering code and such. These objects might get processed1252 * inside of a worker. The `PDFObjects` implements some basic functions to1253 * manage these objects.1254 * @ignore1255 */1256var PDFObjects = (function PDFObjectsClosure() {1257 function PDFObjects() {1258 this.objs = {};1259 }1260 PDFObjects.prototype = {1261 /**1262 * Internal function.1263 * Ensures there is an object defined for `objId`.1264 */1265 ensureObj: function PDFObjects_ensureObj(objId) {1266 if (this.objs[objId]) {1267 return this.objs[objId];1268 }1269 var obj = {1270 capability: createPromiseCapability(),1271 data: null,1272 resolved: false1273 };1274 this.objs[objId] = obj;1275 return obj;1276 },1277 /**1278 * If called *without* callback, this returns the data of `objId` but the1279 * object needs to be resolved. If it isn't, this function throws.1280 *1281 * If called *with* a callback, the callback is called with the data of the1282 * object once the object is resolved. That means, if you call this1283 * function and the object is already resolved, the callback gets called1284 * right away.1285 */1286 get: function PDFObjects_get(objId, callback) {1287 // If there is a callback, then the get can be async and the object is1288 // not required to be resolved right now1289 if (callback) {1290 this.ensureObj(objId).capability.promise.then(callback);1291 return null;1292 }1293 // If there isn't a callback, the user expects to get the resolved data1294 // directly.1295 var obj = this.objs[objId];1296 // If there isn't an object yet or the object isn't resolved, then the1297 // data isn't ready yet!1298 if (!obj || !obj.resolved) {1299 error('Requesting object that isn\'t resolved yet ' + objId);1300 }1301 return obj.data;1302 },1303 /**1304 * Resolves the object `objId` with optional `data`.1305 */1306 resolve: function PDFObjects_resolve(objId, data) {1307 var obj = this.ensureObj(objId);1308 obj.resolved = true;1309 obj.data = data;1310 obj.capability.resolve(data);1311 },1312 isResolved: function PDFObjects_isResolved(objId) {1313 var objs = this.objs;1314 if (!objs[objId]) {1315 return false;1316 } else {1317 return objs[objId].resolved;1318 }1319 },1320 hasData: function PDFObjects_hasData(objId) {1321 return this.isResolved(objId);1322 },1323 /**1324 * Returns the data of `objId` if object exists, null otherwise.1325 */1326 getData: function PDFObjects_getData(objId) {1327 var objs = this.objs;1328 if (!objs[objId] || !objs[objId].resolved) {1329 return null;1330 } else {1331 return objs[objId].data;1332 }1333 },1334 clear: function PDFObjects_clear() {1335 this.objs = {};1336 }1337 };1338 return PDFObjects;1339})();1340/**1341 * Allows controlling of the rendering tasks.1342 * @class1343 */1344var RenderTask = (function RenderTaskClosure() {1345 function RenderTask(internalRenderTask) {1346 this._internalRenderTask = internalRenderTask;1347 /**1348 * Callback for incremental rendering -- a function that will be called1349 * each time the rendering is paused. To continue rendering call the1350 * function that is the first argument to the callback.1351 * @type {function}1352 */1353 this.onContinue = null;1354 }1355 RenderTask.prototype = /** @lends RenderTask.prototype */ {1356 /**1357 * Promise for rendering task completion.1358 * @return {Promise}1359 */1360 get promise() {1361 return this._internalRenderTask.capability.promise;1362 },1363 /**1364 * Cancels the rendering task. If the task is currently rendering it will1365 * not be cancelled until graphics pauses with a timeout. The promise that1366 * this object extends will resolved when cancelled.1367 */1368 cancel: function RenderTask_cancel() {1369 this._internalRenderTask.cancel();1370 },1371 /**1372 * Registers callbacks to indicate the rendering task completion.1373 *1374 * @param {function} onFulfilled The callback for the rendering completion.1375 * @param {function} onRejected The callback for the rendering failure.1376 * @return {Promise} A promise that is resolved after the onFulfilled or1377 * onRejected callback.1378 */1379 then: function RenderTask_then(onFulfilled, onRejected) {1380 return this.promise.then.apply(this.promise, arguments);1381 }1382 };1383 return RenderTask;1384})();1385/**1386 * For internal use only.1387 * @ignore1388 */1389var InternalRenderTask = (function InternalRenderTaskClosure() {1390 function InternalRenderTask(callback, params, objs, commonObjs, operatorList,1391 pageNumber) {1392 this.callback = callback;1393 this.params = params;1394 this.objs = objs;1395 this.commonObjs = commonObjs;1396 this.operatorListIdx = null;1397 this.operatorList = operatorList;1398 this.pageNumber = pageNumber;1399 this.running = false;1400 this.graphicsReadyCallback = null;1401 this.graphicsReady = false;1402 this.cancelled = false;1403 this.capability = createPromiseCapability();1404 this.task = new RenderTask(this);1405 // caching this-bound methods1406 this._continueBound = this._continue.bind(this);1407 this._scheduleNextBound = this._scheduleNext.bind(this);1408 this._nextBound = this._next.bind(this);1409 }1410 InternalRenderTask.prototype = {1411 initalizeGraphics:1412 function InternalRenderTask_initalizeGraphics(transparency) {1413 if (this.cancelled) {1414 return;1415 }1416 if (PDFJS.pdfBug && 'StepperManager' in globalScope &&1417 globalScope.StepperManager.enabled) {1418 this.stepper = globalScope.StepperManager.create(this.pageNumber - 1);1419 this.stepper.init(this.operatorList);1420 this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();1421 }1422 var params = this.params;1423 this.gfx = new CanvasGraphics(params.canvasContext, this.commonObjs,1424 this.objs, params.imageLayer);1425 this.gfx.beginDrawing(params.viewport, transparency);1426 this.operatorListIdx = 0;1427 this.graphicsReady = true;1428 if (this.graphicsReadyCallback) {1429 this.graphicsReadyCallback();1430 }1431 },1432 cancel: function InternalRenderTask_cancel() {1433 this.running = false;1434 this.cancelled = true;1435 this.callback('cancelled');1436 },1437 operatorListChanged: function InternalRenderTask_operatorListChanged() {1438 if (!this.graphicsReady) {1439 if (!this.graphicsReadyCallback) {1440 this.graphicsReadyCallback = this._continueBound;1441 }1442 return;1443 }1444 if (this.stepper) {1445 this.stepper.updateOperatorList(this.operatorList);1446 }1447 if (this.running) {1448 return;1449 }1450 this._continue();1451 },...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var wp = new wptools.page('Paris');3wp.getOperatorList(function(err, data) {4 if (err) {5 console.log(err);6 } else {7 console.log(data);8 }9});10var wptools = require('wptools');11var wp = new wptools.page('Paris');12wp.getOperatorList(function(err, data) {13 if (err) {14 console.log(err);15 } else {16 console.log(data);17 }18});19var wptools = require('wptools');20var wp = new wptools.page('Paris');21wp.getOperatorList(function(err, data) {22 if (err) {23 console.log(err);24 } else {25 console.log(data);26 }27});28var wptools = require('wptools');29var wp = new wptools.page('Paris');30wp.getOperatorList(function(err, data) {31 if (err) {32 console.log(err);33 } else {34 console.log(data);35 }36});37var wptools = require('wptools');38var wp = new wptools.page('Paris');39wp.getOperatorList(function(err, data) {40 if (err) {41 console.log(err);42 } else {43 console.log(data);44 }45});46var wptools = require('wptools');47var wp = new wptools.page('Paris');48wp.getOperatorList(function(err, data) {49 if (err) {50 console.log(err);51 } else {52 console.log(data);53 }54});55var wptools = require('wptools');56var wp = new wptools.page('Paris');57wp.getOperatorList(function(err, data) {58 if (err) {59 console.log(err);60 } else {61 console.log(data);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var wp = new wptoolkit();3wp.init(function(err) {4 if (err) {5 console.log(err);6 } else {7 console.log('ready');8 }9});10wp.on('operatorListChanged', function(err, list) {11 console.log(list);12});13wp.start();14{15 "dependencies": {16 }17}18var wptoolkit = require('wptoolkit');19var wp = new wptoolkit();20wp.init(function(err) {21 if (err) {22 console.log(err);23 } else {24 console.log('ready');25 }26});27wp.on('operatorListChanged', function(err, list) {28 console.log(list);29});30wp.start();31{32 "dependencies": {33 }34}35var wptoolkit = require('wptoolkit');36var wp = new wptoolkit();37wp.init(function(err) {38 if (err) {39 console.log(err);40 } else {41 console.log('ready');42 }43});44wp.on('operatorListChanged', function(err, list) {45 console.log(list);46});47wp.start();48{49 "dependencies": {50 }51}52var wptoolkit = require('wptoolkit');53var wp = new wptoolkit();54wp.init(function(err) {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var wp = new wptoolkit();3wp.operatorListChanged(function(operatorList){4 console.log(operatorList);5});6var wptoolkit = require('wptoolkit');7var wp = new wptoolkit();8wp.operatorListChanged(function(operatorList){9 console.log(operatorList);10});11var wptoolkit = require('wptoolkit');12var wp = new wptoolkit();13wp.operatorListChanged(function(operatorList){14 console.log(operatorList);15});16var wptoolkit = require('wptoolkit');17var wp = new wptoolkit();18wp.operatorListChanged(function(operatorList){19 console.log(operatorList);20});21var wptoolkit = require('wptoolkit');22var wp = new wptoolkit();23wp.operatorListChanged(function(operatorList){24 console.log(operatorList);25});26var wptoolkit = require('wptoolkit');27var wp = new wptoolkit();28wp.operatorListChanged(function(operatorList){29 console.log(operatorList);30});31var wptoolkit = require('wptoolkit');32var wp = new wptoolkit();33wp.operatorListChanged(function(operatorList){34 console.log(operatorList);35});36var wptoolkit = require('wptoolkit');37var wp = new wptoolkit();38wp.operatorListChanged(function(operatorList){39 console.log(operatorList);40});41var wptoolkit = require('wptoolkit');42var wp = new wptoolkit();43wp.operatorListChanged(function(operatorList){44 console.log(operatorList);45});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var wp = new wptoolkit();3wp.operatorListChanged(function(err, response){4});5var wptoolkit = require('wptoolkit');6var wp = new wptoolkit();7wp.operatorListChanged(function(err, response){8});9var wptoolkit = require('wptoolkit');10var wp = new wptoolkit();11wp.operatorListChanged(function(err, response){12});13var wptoolkit = require('wptoolkit');14var wp = new wptoolkit();15wp.operatorListChanged(function(err, response){16});17var wptoolkit = require('wptoolkit');18var wp = new wptoolkit();19wp.operatorListChanged(function(err, response){20});21var wptoolkit = require('wptoolkit');22var wp = new wptoolkit();23wp.operatorListChanged(function(err, response){24});25var wptoolkit = require('wptoolkit');26var wp = new wptoolkit();27wp.operatorListChanged(function(err, response){28});29var wptoolkit = require('wptoolkit');30var wp = new wptoolkit();31wp.operatorListChanged(function(err, response){32});33var wptoolkit = require('wptoolkit');

Full Screen

Using AI Code Generation

copy

Full Screen

1var operatorListChanged = function (wptextview, operatorList) {2 console.log("operatorListChanged");3 console.log(operatorList);4 console.log("operatorListChanged");5};6var operatorListChanged = function (wptextview, operatorList) {7 console.log("operatorListChanged");8 console.log(operatorList);9 console.log("operatorListChanged");10};11var operatorListChanged = function (wptextview, operatorList) {12 console.log("operatorListChanged");13 console.log(operatorList);14 console.log("operatorListChanged");15};16var operatorListChanged = function (wptextview, operatorList) {17 console.log("operatorListChanged");18 console.log(operatorList);19 console.log("operatorListChanged");20};21var operatorListChanged = function (wptextview, operatorList) {22 console.log("operatorListChanged");23 console.log(operatorList);24 console.log("operatorListChanged");25};26var operatorListChanged = function (wptextview, operatorList) {27 console.log("operatorListChanged");28 console.log(operatorList);29 console.log("operatorListChanged");30};31var operatorListChanged = function (wptextview, operatorList) {32 console.log("operatorListChanged");33 console.log(operatorList);34 console.log("operatorListChanged");35};36var operatorListChanged = function (wptextview, operatorList) {37 console.log("operatorListChanged");38 console.log(operatorList);39 console.log("operatorListChanged");40};41var operatorListChanged = function (wptextview, operatorList) {42 console.log("operatorListChanged");43 console.log(operatorList);44 console.log("operatorListChanged");45};46var operatorListChanged = function (wptextview, operatorList) {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptk = new Wptoolkit();2var wptkOperators = wptk.operatorListChanged();3var wptkOperatorsArray = wptkOperators.split(";");4var wptkOperatorsListBox = document.getElementById("wptkOperatorsListBox");5for (var i = 0; i < wptkOperatorsArray.length; i++) {6 var wptkOperatorsListBoxItem = document.createElement("listitem");7 wptkOperatorsListBoxItem.setAttribute("label", wptkOperatorsArray[i]);8 wptkOperatorsListBox.appendChild(wptkOperatorsListBoxItem);9}

Full Screen

Using AI Code Generation

copy

Full Screen

1function operatorListChanged() {2 var operatorList = wptextinput.getOperatorList();3 var operatorListElement = document.getElementById("operators");4 operatorListElement.innerHTML = "";5 for (var i = 0; i < operatorList.length; i++) {6 var option = document.createElement("option");7 option.text = operatorList[i];8 option.value = operatorList[i];9 operatorListElement.add(option);10 }11}12function operatorChanged() {13 var operatorElement = document.getElementById("operators");14 operatorElement.value = wptextinput.getOperator();15}16function operatorListChanged() {17 var operatorList = wptextinput.getOperatorList();18 var operatorListElement = document.getElementById("operators");19 operatorListElement.innerHTML = "";20 for (var i = 0; i < operatorList.length; i++) {21 var option = document.createElement("option");22 option.text = operatorList[i];23 option.value = operatorList[i];24 operatorListElement.add(option);25 }26}27function operatorChanged() {28 var operatorElement = document.getElementById("operators");29 operatorElement.value = wptextinput.getOperator();30}31function operatorListChanged() {32 var operatorList = wptextinput.getOperatorList();33 var operatorListElement = document.getElementById("operators");34 operatorListElement.innerHTML = "";35 for (var i = 0; i < operatorList.length; i++) {

Full Screen

Using AI Code Generation

copy

Full Screen

1function showOperators() {2 var operators = wptoolkit.operatorListChanged();3 var table = document.getElementById("operatorTable");4 var tableBody = table.getElementsByTagName("tbody")[0];5 tableBody.innerHTML = "";6 if (operators.length == 0) {7 tableBody.innerHTML = "No operators found";8 }9 else {10 for (var i = 0; i < operators.length; i++) {11 var row = document.createElement("tr");12 var cell = document.createElement("td");13 cell.innerHTML = operators[i].name;14 row.appendChild(cell);15 cell = document.createElement("td");16 cell.innerHTML = operators[i].country;17 row.appendChild(cell);18 cell = document.createElement("td");19 cell.innerHTML = operators[i].mcc;20 row.appendChild(cell);21 cell = document.createElement("td");22 cell.innerHTML = operators[i].mnc;23 row.appendChild(cell);24 tableBody.appendChild(row);25 }26 }27}28window.onload = showOperators;29In the above code, wptoolkit.operatorListChanged() method is used to get the list of all operators. This method returns an array of objects. Each object in this array contains the information about an operator. Each object has the following properties:

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful