This file contains hidden or 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
var ids = String( | |
this.req.param('id') || | |
this.req.param('ids') | |
).match(/(\d+)/g); |
This file contains hidden or 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
basis.require('basis.data.value'); | |
basis.require('basis.dom'); | |
var DOM = basis.dom; | |
var BindValue = basis.data.value.BindValue; | |
var DOM_INSERT_HANDLER = function(value){ | |
DOM.insert(DOM.clear(this), value); | |
}; |
This file contains hidden or 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
basis.require('basis.event'); | |
basis.require('basis.data'); | |
var datasetComputeFunctions = {}; | |
basis.data.AbstractDataset.extend({ | |
/** | |
* @param {string|Array.<string>=} events |
This file contains hidden or 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
<b:style src="./item.css"/> | |
<b:define name="nestedViewCount" type="bool"/> | |
<b:define name="satelliteName" type="bool"/> | |
<b:define name="namespace" type="bool"/> | |
<div class="basisjs-devpanel-ui-view-item"> | |
<div class="basisjs-devpanel-ui-view-item__title" event-click="toggle" event-mouseenter="enter" event-mouseleave="leave"> | |
<div class="basisjs-devpanel-ui-view-item__expander basisjs-devpanel-ui-view-item__expander_{nestedViewCount}"/> | |
<span class="basisjs-devpanel-ui-view-item__satelliteName basisjs-devpanel-ui-view-item__satelliteName_{satelliteName}"> | |
{satelliteName} |
This file contains hidden or 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
// | |
// Closure | |
// | |
var a = []; // хранилище истансов, чтобы они не разрушались (не собирались GC) | |
var getClosure = function(a){ return function(b){ return fn(a, b); } }; | |
var t = performance.now(); | |
for (var i = 0; i < 10000; i++) | |
a.push(getClosure(i)); |
This file contains hidden or 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
// | |
// Case 1 | |
// | |
var a = []; | |
var t = performance.now(); | |
for (var i = 0; i < 10000; i++) | |
a.push(new Promise(function(){})); | |
This file contains hidden or 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
// create element with color green | |
var elem = document.createElement('div'); | |
elem.style.color = 'green'; | |
document.body.appendChild(elem); // add to document, to make getComputedStyle/animate works | |
console.log(getComputedStyle(elem).color); // rgb(0, 128, 0) - it's OK! | |
// add animation | |
var player = elem.animate([ | |
{ color: 'red' }, | |
{ color: 'blue' } |
This file contains hidden or 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
// we could create several effects for node/models and don't affect node/models | |
var source = new basis.data.Dataset({ items: [/* .. */]}); | |
var modified = new basis.data.dataset.Filter({ | |
source: source, | |
ruleEvents: 'rollbackUpdate', | |
rule: 'data.modified' | |
}); | |
var customSet = new basis.data.Dataset(); | |
var view = new basis.ui.Node({ |
This file contains hidden or 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 getRange(str, start, end){ | |
var lines = str | |
.split('\n') | |
.slice(start.line - 1, end.line); | |
return lines | |
.concat(lines.pop().substr(0, end.column)) | |
.join('\n') | |
.substr(start.column - 1); | |
} |
This file contains hidden or 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
// | |
// Enum class is proposed future citizen of basis.js | |
// | |
var Value = require('basis.data').Value; | |
var Enum = Value.subclass({ | |
className: 'Enum', | |
init: function(){ |