Skip to content

Commit a7ef384

Browse files
committed
Rename F.onLocate to F.onLocale.
1 parent ef5ecbb commit a7ef384

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

changes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- updated: `SINGLETON(name, [def = {}])`
77
- updated: `debug.js` add timestamps
88

9+
-renamed: `F.onLocate` renamed to `F.onLocale`
10+
911
======= 2.1.0
1012

1113
- added: `F.sitemap_add(string)` for adding entries to sitemap by Martin Smola <https://github.com/molda>

index.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,23 @@ function Framework() {
714714
// PROTOTYPES
715715
// ======================================================
716716

717-
Framework.prototype.__proto__ = new events.EventEmitter();
717+
Framework.prototype = {
718+
get onLocate() {
719+
return this.onLocale;
720+
},
721+
set onLocate(value) {
722+
OBSOLETE('F.onLocate', 'Rename "F.onLocate" method for "F.onLocale".');
723+
this.onLocale = value;
724+
}
725+
}
726+
727+
Framework.prototype.__proto__ = Object.create(events.EventEmitter.prototype, {
728+
constructor: {
729+
value: WebSocket,
730+
enumberable: false
731+
}
732+
});
733+
718734

719735
/**
720736
* Internal function
@@ -3869,7 +3885,8 @@ Framework.prototype.onAuthorize = null;
38693885
@res {Response} OR {WebSocketClient}
38703886
@return {String}
38713887
*/
3872-
Framework.prototype.onLocate = null;
3888+
Framework.prototype.onLocale = null;
3889+
// OLD: Framework.prototype.onLocate = null;
38733890

38743891
/**
38753892
* Sets theme to controlller
@@ -6523,8 +6540,8 @@ Framework.prototype.listener = function(req, res) {
65236540
}
65246541
}
65256542

6526-
if (can && self.onLocate)
6527-
req.$language = self.onLocate(req, res, req.isStaticFile);
6543+
if (can && self.onLocale)
6544+
req.$language = self.onLocale(req, res, req.isStaticFile);
65286545

65296546
self._request_stats(true, true);
65306547

@@ -6955,8 +6972,8 @@ Framework.prototype._upgrade = function(req, socket, head) {
69556972
req.path = framework_internal.routeSplit(req.uri.pathname);
69566973
req.websocket = websocket;
69576974

6958-
if (self.onLocate)
6959-
req.$language = self.onLocate(req, socket);
6975+
if (self.onLocale)
6976+
req.$language = self.onLocale(req, socket);
69606977

69616978
if (self._length_request_middleware && !req.behaviour('disable-middleware'))
69626979
async_middleware(0, req, req.websocket, self.routes.request, () => self._upgrade_prepare(req, path, req.headers));

test/test-framework-debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ framework.onCompileView = function(name, html, model) {
1515
return html + 'COMPILED';
1616
};
1717

18-
framework.onLocate = function(req) {
18+
framework.onLocale = function(req) {
1919
return !req.url.startsWith('/abc') ? 'sk' : '';
2020
};
2121

test/test-framework-release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ framework.onCompileView = function(name, html, model) {
1515
return html + 'COMPILED';
1616
};
1717

18-
framework.onLocate = function(req) {
18+
framework.onLocale = function(req) {
1919
return !req.url.startsWith('/abc') ? 'sk' : '';
2020
};
2121

0 commit comments

Comments
 (0)