How to use expose method in wpt

Best JavaScript code snippet using wpt

Plugin.js

Source:Plugin.js Github

copy

Full Screen

1/****************************************************************************2 Copyright (c) 2013-2014 Chukong Technologies Inc.3 http://www.cocos2d-x.org4 Permission is hereby granted, free of charge, to any person obtaining a copy5 of this software and associated documentation files (the "Software"), to deal6 in the Software without restriction, including without limitation the rights7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell8 copies of the Software, and to permit persons to whom the Software is9 furnished to do so, subject to the following conditions:10 The above copyright notice and this permission notice shall be included in11 all copies or substantial portions of the Software.12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR13 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,14 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE15 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER16 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,17 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN18 THE SOFTWARE.19 ****************************************************************************/20/**21 * plugin manager22 * @class23 *24 */25(function(){26 if(cc === undefined){27 return;28 }29 var config = cc.game.config.plugin || {};30 //Native plugin usage31 var PluginManager = function(){};32 PluginManager.prototype = {33 constructor: PluginManager,34 /**35 * @returns {PluginManager}36 * @expose37 */38 getInstance: function(){39 return this;40 },41 /**42 * @param {String} pluginName43 * @expose44 */45 loadPlugin: function(pluginName){46 },47 /**48 *49 * @param pluginName50 * @expose51 */52 unloadPlugin: function(pluginName){53 }54 };55 var PluginAssembly = function(){};56 PluginAssembly.prototype = {57 constructor: PluginAssembly,58 /**59 * @param {Boolean} debug60 * @expose61 */62 setDebugMode: function(debug){},63 /**64 * @param {String} appKey65 * @expose66 */67 startSession: function(appKey){},68 /**69 * @param {Boolean} Capture70 * @expose71 */72 setCaptureUncaughtException: function(Capture){},73 /**74 * @param {String} funName75 * @param {All} Params76 * @expose77 */78 callFuncWithParam: function(funName){79 if(typeof this[funName] === 'function'){80 return this[funName].apply(this, Array.prototype.splice.call(arguments, 1));81 }else{82 cc.log("function is not define");83 }84 },85 /**86 * @param {String} funName87 * @param {All} Params88 * @expose89 */90 callStringFuncWithParam: function(funName){91 this.callFuncWithParam.apply(arguments);92 },93 /**94 * @returns {String}95 * @expose96 */97 getPluginName: function(){98 return this._name;99 },100 /**101 * @returns {String}102 * @expose103 */104 getPluginVersion: function(){105 return this._version;106 }107 };108 /** @expose */109 PluginAssembly.extend = function(name, porp){110 var p, prototype = {};111 for(p in PluginAssembly.prototype){112 prototype[p] = PluginAssembly.prototype[p];113 }114 for(p in porp){115 prototype[p] = porp[p];116 }117 var tmp = eval("(function " + name + "Plugin(){})");118 prototype.constructor = tmp;119 tmp.prototype = prototype;120 return tmp;121 };122 //Param123 var Param = function(type, value){124 var paramType = plugin.PluginParam.ParamType,tmpValue;125 switch(type){126 case paramType.TypeInt:127 tmpValue = parseInt(value);128 break;129 case paramType.TypeFloat:130 tmpValue = parseFloat(value);131 break;132 case paramType.TypeBool:133 tmpValue = Boolean(value);134 break;135 case paramType.TypeString:136 tmpValue = String(value);137 break;138 case paramType.TypeStringMap:139 tmpValue = value//JSON.stringify(value);140 break;141 default:142 tmpValue = value;143 }144 return tmpValue145 };146 /** @expose */147 Param.ParamType = {148 /** @expose */149 TypeInt:1,150 /** @expose */151 TypeFloat:2,152 /** @expose */153 TypeBool:3,154 /** @expose */155 TypeString:4,156 /** @expose */157 TypeStringMap:5158 };159 /** @expose */160 Param.AdsResultCode = {161 /** @expose */162 AdsReceived:0,163 /** @expose */164 FullScreenViewShown:1,165 /** @expose */166 FullScreenViewDismissed:2,167 /** @expose */168 PointsSpendSucceed:3,169 /** @expose */170 PointsSpendFailed:4,171 /** @expose */172 NetworkError:5,173 /** @expose */174 UnknownError:6175 };176 /** @expose */177 Param.PayResultCode = {178 /** @expose */179 PaySuccess:0,180 /** @expose */181 PayFail:1,182 /** @expose */183 PayCancel:2,184 /** @expose */185 PayTimeOut:3186 };187 /** @expose */188 Param.ShareResultCode = {189 /** @expose */190 ShareSuccess:0,191 /** @expose */192 ShareFail:1,193 /** @expose */194 ShareCancel:2,195 /** @expose */196 ShareTimeOut:3197 };198 /** @expose */199 var PluginList = {};200 /** @expose */201 var Plugin = {202 /** @expose */203 extend: function(name, extend){204 PluginList[name] = new (PluginAssembly.extend(name, extend));205 typeof PluginList[name].ctor === "function" && PluginList[name].ctor(config[name]);206 },207 /** @expose */208 PluginList: PluginList,209 /** @expose */210 PluginParam: Param,211 /** @expose */212 PluginManager: new PluginManager()213 };214 /** @expose */215 window.plugin = Plugin;...

Full Screen

Full Screen

BaseNodesPropertyDefine.js

Source:BaseNodesPropertyDefine.js Github

copy

Full Screen

1/****************************************************************************2 Copyright (c) 2008-2010 Ricardo Quesada3 Copyright (c) 2011-2012 cocos2d-x.org4 Copyright (c) 2013-2014 Chukong Technologies Inc.5 http://www.cocos2d-x.org6 Permission is hereby granted, free of charge, to any person obtaining a copy7 of this software and associated documentation files (the "Software"), to deal8 in the Software without restriction, including without limitation the rights9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10 copies of the Software, and to permit persons to whom the Software is11 furnished to do so, subject to the following conditions:12 The above copyright notice and this permission notice shall be included in13 all copies or substantial portions of the Software.14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN20 THE SOFTWARE.21 ****************************************************************************/22cc._tmp.PrototypeCCNode = function () {23 var _p = cc.Node.prototype;24 cc.defineGetterSetter(_p, "x", _p.getPositionX, _p.setPositionX);25 cc.defineGetterSetter(_p, "y", _p.getPositionY, _p.setPositionY);26 /** @expose */27 _p.width;28 cc.defineGetterSetter(_p, "width", _p._getWidth, _p._setWidth);29 /** @expose */30 _p.height;31 cc.defineGetterSetter(_p, "height", _p._getHeight, _p._setHeight);32 /** @expose */33 _p.anchorX;34 cc.defineGetterSetter(_p, "anchorX", _p._getAnchorX, _p._setAnchorX);35 /** @expose */36 _p.anchorY;37 cc.defineGetterSetter(_p, "anchorY", _p._getAnchorY, _p._setAnchorY);38 /** @expose */39 _p.skewX;40 cc.defineGetterSetter(_p, "skewX", _p.getSkewX, _p.setSkewX);41 /** @expose */42 _p.skewY;43 cc.defineGetterSetter(_p, "skewY", _p.getSkewY, _p.setSkewY);44 /** @expose */45 _p.zIndex;46 cc.defineGetterSetter(_p, "zIndex", _p.getLocalZOrder, _p.setLocalZOrder);47 /** @expose */48 _p.vertexZ;49 cc.defineGetterSetter(_p, "vertexZ", _p.getVertexZ, _p.setVertexZ);50 /** @expose */51 _p.rotation;52 cc.defineGetterSetter(_p, "rotation", _p.getRotation, _p.setRotation);53 /** @expose */54 _p.rotationX;55 cc.defineGetterSetter(_p, "rotationX", _p.getRotationX, _p.setRotationX);56 /** @expose */57 _p.rotationY;58 cc.defineGetterSetter(_p, "rotationY", _p.getRotationY, _p.setRotationY);59 /** @expose */60 _p.scale;61 cc.defineGetterSetter(_p, "scale", _p.getScale, _p.setScale);62 /** @expose */63 _p.scaleX;64 cc.defineGetterSetter(_p, "scaleX", _p.getScaleX, _p.setScaleX);65 /** @expose */66 _p.scaleY;67 cc.defineGetterSetter(_p, "scaleY", _p.getScaleY, _p.setScaleY);68 /** @expose */69 _p.children;70 cc.defineGetterSetter(_p, "children", _p.getChildren);71 /** @expose */72 _p.childrenCount;73 cc.defineGetterSetter(_p, "childrenCount", _p.getChildrenCount);74 /** @expose */75 _p.parent;76 cc.defineGetterSetter(_p, "parent", _p.getParent, _p.setParent);77 /** @expose */78 _p.visible;79 cc.defineGetterSetter(_p, "visible", _p.isVisible, _p.setVisible);80 /** @expose */81 _p.running;82 cc.defineGetterSetter(_p, "running", _p.isRunning);83 /** @expose */84 _p.ignoreAnchor;85 cc.defineGetterSetter(_p, "ignoreAnchor", _p.isIgnoreAnchorPointForPosition, _p.ignoreAnchorPointForPosition);86 /** @expose */87 _p.tag;88 /** @expose */89 _p.userData;90 /** @expose */91 _p.userObject;92 /** @expose */93 _p.arrivalOrder;94 /** @expose */95 _p.actionManager;96 cc.defineGetterSetter(_p, "actionManager", _p.getActionManager, _p.setActionManager);97 /** @expose */98 _p.scheduler;99 cc.defineGetterSetter(_p, "scheduler", _p.getScheduler, _p.setScheduler);100 //cc.defineGetterSetter(_p, "boundingBox", _p.getBoundingBox);101 /** @expose */102 _p.shaderProgram;103 cc.defineGetterSetter(_p, "shaderProgram", _p.getShaderProgram, _p.setShaderProgram);104 /** @expose */105 _p.opacity;106 cc.defineGetterSetter(_p, "opacity", _p.getOpacity, _p.setOpacity);107 /** @expose */108 _p.opacityModifyRGB;109 cc.defineGetterSetter(_p, "opacityModifyRGB", _p.isOpacityModifyRGB);110 /** @expose */111 _p.cascadeOpacity;112 cc.defineGetterSetter(_p, "cascadeOpacity", _p.isCascadeOpacityEnabled, _p.setCascadeOpacityEnabled);113 /** @expose */114 _p.color;115 cc.defineGetterSetter(_p, "color", _p.getColor, _p.setColor);116 /** @expose */117 _p.cascadeColor;118 cc.defineGetterSetter(_p, "cascadeColor", _p.isCascadeColorEnabled, _p.setCascadeColorEnabled);...

Full Screen

Full Screen

Tag.js

Source:Tag.js Github

copy

Full Screen

1{2 function expose(callSite, var_args) {3 assertTrue(Array.isArray(callSite));4 assertTrue(Object.isFrozen(callSite));5 var rawDescr = Object.getOwnPropertyDescriptor(callSite, 'raw');6 assertTrue(rawDescr !== undefined);7 assertTrue('value' in rawDescr);8 assertFalse(rawDescr.enumerable);9 assertFalse(rawDescr.writable);10 assertFalse(rawDescr.configurable);11 assertTrue(Object.isFrozen(callSite.raw));12 assertTrue(Array.isArray(callSite.raw));13 assertTrue(Object.isFrozen(callSite.raw));14 assertEquals(callSite.raw.length, callSite.length);15 // The number of the literal portions is always same or one greater than the16 // number of substitutions...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var publicWPT = wpt('www.webpagetest.org');3publicWPT.getLocations(function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});7 if (err) return console.error(err);8 console.log(data);9});10MIT License. See [LICENSE](

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2 if (err) {3 console.log(err);4 } else {5 console.log(data);6 }7});8var wpt = require('wpt');9 if (err) {10 console.log(err);11 } else {12 console.log(data);13 }14});15var wpt = require('wpt');16 if (err) {17 console.log(err);18 } else {19 console.log(data);20 }21});22var wpt = require('wpt');23 if (err) {24 console.log(err);25 } else {26 console.log(data);27 }28});29var wpt = require('wpt');30 if (err) {31 console.log(err);32 } else {33 console.log(data);34 }35});36var wpt = require('wpt');37 if (err) {38 console.log(err);39 } else {40 console.log(data);41 }42});43var wpt = require('wpt');44 if (err) {45 console.log(err);46 } else {47 console.log(data);48 }49});50var wpt = require('wpt');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var wpt = new WebPageTest('www.webpagetest.org', options.key);5wpt.runTest(url, {6 lighthouseConfig: {7 settings: {8 }9 }10}, function (err, data) {11 if (err) return console.error(err);12 console.log(data);13 wpt.getTestResults(data.data.testId, function (err, data) {14 if (err) return console.error(err);15 console.log(data);16 });17});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var test = new wpt(options);5var testOptions = {6 videoParams: {7 },8 timelineParams: {9 },10 lighthouseParams: {11 'throttling': {12 }13 }14};15test.runTest(testUrl, testOptions, function (err, data) {16 if (err) {17 console.log(err);18 } else {19 console.log(data);20 }21});

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