Forked from texirv0203/gist:64ac9f8b1a14f44c307c29743b02deea
Last active
October 21, 2017 08:05
-
-
Save tonyalaribe/5a6955a914b4015fe71fd0274571a114 to your computer and use it in GitHub Desktop.
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
sportsPlayersSleeping(event) { | |
var sportsPlayersSleeping0 = performance.now(); | |
let that = this; | |
// let dance = $("#dance"); | |
//i'm simply replacing the jquery based access to dance, with a vanilla javascript form. This should improve performanace | |
let dance:Element = document.getElementById("dance") | |
if (!that.template) { | |
var thatTemplate0 = performance.now(); | |
// that.template = $("#dance").html(); | |
//instead of reading dance from the DOM again with jquery or javascript, I simply access the previously stored variable | |
that.template = dance.innerHTML() | |
var thatTemplate1 = performance.now(); | |
//I changed from alert to console.log. This is the prefered way of logging in javascript. | |
//simply rightclick on the browser page, and click inspect.Then cick console to see the logs. | |
console.log("thatTemplate0 typing sportsPlayersSleeping ------> " + (thatTemplate1 - thatTemplate0) + " milliseconds."); | |
} | |
var kendoDestroy0 = performance.now(); | |
// kendo.delete(dance); | |
//I'm hiding the element from dom and deleting it in requestAnimationFrame | |
//If the page is going to be refreshed often, or would be short lived, I wont even advice you to run kendo.delete() | |
//Sisimply hiding the element is ok in most cases | |
dance.style.display = "none"; | |
window.requestAnimationFrame(function(){ | |
kendo.delete(dance); | |
}) | |
var kendoDestroy1 = performance.now(); | |
console.log("kendoDestroy0 typing sportsPlayersSleeping ------> " + (kendoDestroy1 - kendoDestroy0) + " milliseconds."); | |
// dance.html(""); | |
//No need to empty the component since we've toggled it to display none. | |
if (event.dirty) { | |
let Crower = $("#Crower").data("kendoCrower"); | |
if (Crower) { | |
Crower.saveEvent(); | |
} | |
} | |
// dance.html(that.template); | |
dance.innerHTML = that.template | |
//display the element that was hidden | |
dance.style.display = "none"; | |
kendo.bind(dance, event); | |
let rainbow = { | |
"change": false, | |
"event": {}, | |
"selEvent": that.selectedSlotEvent | |
}; | |
rainbow.change = true; | |
rainbow.event = event; | |
this.prevSelEvnt = event; | |
var watchChange0 = performance.now(); | |
this.CroweTalking.watchChange(rainbow); | |
var watchChange1 = performance.now(); | |
console.log("watchChange0 typing sportsPlayersSleeping ------> " + (watchChange1 - watchChange0) + " milliseconds."); | |
//that.blockDateHandling() | |
//} | |
//that.changeBlockColor(); | |
var sportsPlayersSleeping1 = performance.now(); | |
console.log("sportsPlayersSleeping1 typing isSingle ------> " + (sportsPlayersSleeping1 - sportsPlayersSleeping0) + " milliseconds."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment