This describes the common mistake with using closures in JavaScript.
Consider:
function makeCounter()
{
var obj = {counter: 0};
{"lastUpload":"2018-02-09T11:44:19.004Z","extensionVersion":"v2.8.7"} |
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
// Adjustments particular to this page to ensure we hit desktop breakpoint. | |
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1}); | |
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'}); |
These rules are adopted from the AngularJS commit conventions.
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
function logClass(target: any) { | |
// save a reference to the original constructor | |
var original = target; | |
// a utility function to generate instances of a class | |
function construct(constructor, args) { | |
var c : any = function () { | |
return constructor.apply(this, args); | |
} |
function logClass(target: any) { | |
// save a reference to the original constructor | |
var original = target; | |
// a utility function to generate instances of a class | |
function construct(constructor, args) { | |
var c : any = function () { | |
return constructor.apply(this, args); | |
} |
// Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where | |
// x is any hexadecimal digit and y is one of 8, 9, A, or B (e.g., | |
// f47ac10b-58cc-4372-a567-0e02b2c3d479). | |
// See: http://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 | |
function uuid() { | |
var reservedBitValues = ['8','9','a','b']; | |
return Array.prototype.map.call("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx", function mapUUID(c) { | |
if (c == "x") { | |
return Math.round(Math.random()*16-0.5).toString(16); | |
} |