This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<script> | |
assert(document.readyState === 'loading'); | |
document.addEventListener("DOMContentLoaded", function() { | |
assert(document.readyState === 'interactive'); // <-- | |
setTimeout(function() { | |
assert(document.readyState === 'complete'); | |
}, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "avatarUrl" : null, | |
"email" : "[email protected]", | |
"firstName" : "Emery", | |
"id" : "105288343523146387", | |
"invitationPending" : false, | |
"lastName" : "Stafford", | |
"password" : "yggFjgBNLBN43wkyhKhOu41A67tNV4gw", | |
"passwordResetToken" : null, | |
"passwordResetTokenDate" : null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"document": { | |
"title": "Neuromancer", | |
"year": 1984, | |
"isbn": "0441569595", | |
"authors": [ | |
"William Gibson" | |
] | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script> | |
function createDummyNullable(target) { | |
return new Proxy(target, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CancellablePromise.sequence = function(values) { | |
var children = []; | |
return new A.CancellablePromise( | |
function(resolve, reject) { | |
if (!A.Lang.isArray(values)) { | |
reject(new TypeError('CancellablePromise.sequence expects an array of values or promises')); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cancellable promise. | |
* | |
* @class CancellablePromise | |
* @constructor | |
* @extends {Promise} | |
* @param {Function} fn A function where to insert the logic that resolves this | |
* promise. Receives `fulfill` and `reject` functions as parameters. This | |
* function is called synchronously. | |
* @param {Function} opt_errorCallback Optional error callback to be fired |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Error used as a rejection reason for canceled Promises. | |
* | |
* @class Promise.CancellationError | |
* @constructor | |
* @extends {Error} | |
* @param {String} opt_message An optional debugging message for describing the | |
* cancellation reason. | |
*/ | |
function CancellationError(opt_message) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Y.HeaderView = Y.Base.create('header', Y.View, [], { | |
ATTRS: { | |
container: { value: '#header' } | |
} | |
}); | |
Y.BodyView = Y.Base.create('body', Y.View, [], { | |
ATTRS: { | |
container: { value: '#body' } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function writeTempFile(content, opt_callback) { | |
tmp.file({ postfix: '.html' }, function(err, tmpHtmlPath) { | |
if (!err) { | |
grunt.file.write(tmpHtmlPath, content); | |
} | |
opt_callback && opt_callback(err, tmpHtmlPath); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function html2pdf(path, outputPath, opt_callback) { | |
phantom.create(function(ph) { | |
ph.createPage(function(page) { | |
page.set('paperSize', { | |
format: 'A4', | |
orientation: 'portrait' | |
}); | |
page.open(path, function() { |
NewerOlder