Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createSandbox(endpoint, options) {
function notify(type, args) {
for (var i = 0; i < subscribers[type].length; i++) {
subscribers[type][i].apply(null, args);
}
}
var sessionId = Value.query(endpoint, 'data.sessionId');
var online = Value.query(endpoint, 'data.online');
var publisherExists = Value.query(endpoint, 'delegate.sources.publisher.delegate').as(Boolean);
var sessionOpenned = new Value({ value: false });
var publisherConnected = new Expression(publisherExists, sessionOpenned, function(publisherExists, sessionOpenned) {
return publisherExists && sessionOpenned;
});
var retryTimer;
var subscribers = {
data: [],
session: [],
connection: []
};
var socket = io('', { transports: ['websocket', 'polling'] })
.on('connect', function joinSession() {
socket.emit('rempl:connect to publisher', endpoint.data.endpointId, endpoint.data.name, function(err) {
function createSandbox(endpoint, options) {
function notify(type, args) {
for (var i = 0; i < subscribers[type].length; i++) {
subscribers[type][i].apply(null, args);
}
}
var sessionId = Value.query(endpoint, 'data.sessionId');
var online = Value.query(endpoint, 'data.online');
var publisherExists = Value.query(endpoint, 'delegate.sources.publisher.delegate').as(Boolean);
var sessionOpenned = new Value({ value: false });
var publisherConnected = new Expression(publisherExists, sessionOpenned, function(publisherExists, sessionOpenned) {
return publisherExists && sessionOpenned;
});
var retryTimer;
var subscribers = {
data: [],
session: [],
connection: []
};
var socket = io('', { transports: ['websocket', 'polling'] })
.on('connect', function joinSession() {
socket.emit('rempl:connect to publisher', endpoint.data.endpointId, endpoint.data.name, function(err) {
if (err) {
retryTimer = setTimeout(joinSession, 2000);
module.exports = new Page({
className: 'Page.Env',
satellite: {
content: {
delegate: type.Env,
instance: Node.subclass({
template: resource('./template/env.tmpl'),
binding: {
evnName: Value.query('data.name'),
hasModules: Value.query('data.modules'),
stat: 'satellite:'
},
satellite: {
stat: {
existsIf: Value.query('data.modules'),
delegate: Value.query('data.file'),
instance: FileStat
}
}
})
}
}
});
}
}
});
var Head = TableHead.subclass({
childNodes: [
{ data: { content: dict.token('id') }, columnId: 'id', sortingRule: 'data.index' },
{ data: { content: dict.token('name') }, columnId: 'name', sortingRule: 'data.name' },
{ data: { content: dict.token('size') }, columnId: 'size', sortingRule: 'data.size' }
]
});
var Foot = Node.subclass({
template: resource('./template/foot.tmpl'),
binding: {
count: Value.query('owner.dataSource.itemCount'),
size: sum(Value.query('owner.dataSource'), 'update', 'data.size').as(utils.formatSize),
}
});
var ModuleTable = Table.subclass({
tableId: 'ModuleTable',
sorting: 'data.index',
childClass: Row,
satellite: {
head: Head,
foot: Foot
}
});
module.exports = {
Table: ModuleTable,
var tooltip = new Tooltip({
template: resource('./template/resolving/tooltip.tmpl'),
binding: {
context: function(node) {
return utils.trimContextExpression(Value.query(node, 'data.context'));
},
target: function(node) {
return utils.trimContextExpression(Value.query(node, 'data.target'));
},
type: 'data:'
}
});
var overlay = new Overlay({
template: resource('./template/require/overlay.tmpl'),
dataSource: Value.query('data.resolving'),
binding: {
rawRequest: 'data:'
},
childClass: {
template: resource('./template/resolving/list.tmpl'),
dataSource: Value.query('data.stack'),
binding: {
target: function(node) {
return utils.trimContextExpression(Value.query(node, 'data.target'));
},
context: function(node) {
return utils.trimContextExpression(Value.query(node, 'data.context'));
}
},
childClass: {
template: resource('./template/resolving/item.tmpl'),
return function(node) {
return node[name] && node[name].toFixed(2);
};
}
var GraphNode = Node.subclass({
matched: false,
template: resource('./template/node.tmpl'),
binding: {
x: coord('x'),
y: coord('y'),
fileType: Value.query('data.resource.data.extname').as(getTypeByExt),
isEntry: Value.query('data.reasons.itemCount').as(basis.bool.invert),
moduleType: Value.query('data.type'),
hasSelected: Value.query('parentNode.selection.itemCount').as(Boolean),
matched: Value.query(Module.allWrapper, 'dataset')
.pipe('itemsChanged', function(dataset) {
return basis.array((dataset || Module.allWrapper).getItems());
})
.compute(function(node, matched) {
return matched.indexOf(node.target) !== -1;
})
},
action: {
hover: function() {
fileInfoPopup.setDelegate(this);
},
unhover: function() {
fileInfoPopup.setDelegate();
}
},
binding: {
hasChanges: count(Value.query('data.files'), 'rollbackUpdate', 'modified')
},
action: {
resetSlides: function(){
this.data.files.forEach(function(file){
file.rollback();
});
}
},
childClass: {
active: true,
template: resource('./template/item.tmpl'),
binding: {
name: Value.query('data.filename').as(basis.path.basename),
modified: Value.query('target.modified').as(Boolean)
}
}
});
online.unlink(subscribers);
sandbox.destroy();
sandbox = null;
socket.close();
socket = null;
};
}
module.exports = new Node({
destroySandbox: null,
loading: new basis.Token(false),
error: new basis.Token(false),
template: resource('./template/sandbox.tmpl'),
binding: {
hasPublisher: Value.query('data.id').as(Boolean),
nonExclusiveMode: transport.exclusivePublisher.as(basis.bool.invert),
loading: 'loading',
error: 'error',
online: 'data:',
title: 'data:',
isBrowser: Value.query('data.type').as(function(type) {
return type == 'browser';
}),
isNode: Value.query('data.type').as(function(type) {
return type == 'node';
}),
location: 'data:',
pid: 'data:',
frame: 'satellite:'
},
action: {
env.occurrencesAmount = Value.query(occurrences, 'value.itemCount');
env.occurrencesSize = sum(occurrences, 'update', 'data.size');
env.occurrencesFormattedSize = env.occurrencesSize.as(utils.formatSize);
env.retainedAmount = Value.query(retained, 'value.itemCount');
env.retainedSize = sum(retained, 'update', 'data.size');
env.retainedFormattedSize = env.retainedSize.as(utils.formatSize);
env.exclusiveAmount = Value.query(exclusive, 'value.itemCount');
env.exclusiveSize = sum(exclusive, 'update', 'data.size');
env.exclusiveFormattedSize = env.exclusiveSize.as(utils.formatSize);
var statusText = new Expression(
file,
modules,
Value.query(file, 'value.data.formattedSize'),
sum(modules, 'update', 'data.size').as(utils.formatSize),
env.requiredAmount,
env.requiredFormattedSize,
env.occurrencesAmount,
env.occurrencesFormattedSize,
env.retainedAmount,
env.retainedFormattedSize,
env.exclusiveAmount,
env.exclusiveFormattedSize,
function(file, modules, fileSize, modulesSize, requiredAmount, requiredSize, occurrencesAmount, occurrencesSize,
retainedAmount, retainedSize, exclusiveAmount, exclusiveSize) {
if (!file || !modules) {