Skip to content

Commit ddb803e

Browse files
committed
Update F.worker() - supports packages routing.
1 parent dac0ad8 commit ddb803e

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- updated: `F.redirect()` can contain a relative URL of file
1212
- updated: NoSQL embedded parser, dates are parsed as date object
1313
- updated: `Pagination.next()`, `Pagination.prev()`, `Pagination.last()` and `Pagination.first()` supports new arguments `.html([link_inner_html], [class_name])`
14+
- updated: `F.worker()` supports packages `F.worker('@eshop/myworker-script')`
1415

1516
- improved: `@{href(key, value)}` performance
1617
- improved: Total Package Manager `$ tpm --help`

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8779,7 +8779,7 @@ Framework.prototype.worker = function(name, id, timeout, args) {
87798779
}
87808780

87818781
if (type === 'string')
8782-
fork = self.workers[id] || null;
8782+
fork = self.workers[id];
87838783

87848784
if (id instanceof Array) {
87858785
args = id;
@@ -8795,12 +8795,13 @@ Framework.prototype.worker = function(name, id, timeout, args) {
87958795
if (fork)
87968796
return fork;
87978797

8798-
var filename = framework_utils.combine(self.config['directory-workers'], name) + '.js';
8798+
// @TODO: dokončiť
8799+
var filename = name[0] === '@' ? framework.path.package(name.substring(1)) : framework_utils.combine(self.config['directory-workers'], name);
87998800

88008801
if (!args)
88018802
args = [];
88028803

8803-
fork = Child.fork(filename, args, HEADERS.workers);
8804+
fork = Child.fork(filename[filename.length - 3] === '.' ? filename : filename + '.js', args, HEADERS.workers);
88048805

88058806
if (!id)
88068807
id = name + '_' + new Date().getTime();

test/test-tmp.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ require('../index');
22

33
NOSQL('users').count().callback(function(err, count) {
44
console.log(err, count);
5+
});
6+
7+
F.eval(function() {
8+
console.log(Builders.Page);
59
});

0 commit comments

Comments
 (0)