-
Notifications
You must be signed in to change notification settings - Fork 22
Рендеринг приложения в nodejs #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| "engines": { | ||
| "node": "*" | ||
| }, | ||
| "main": "src/index.js", | ||
| "files": [ | ||
| "css", | ||
| "dist", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| var ns = require('./ns.js'); | ||
|
|
||
| require('./ns.log.js'); | ||
| require('./ns.dom.js'); | ||
| require('./ns.consts.js'); | ||
| require('./ns.consts.events.js'); | ||
| require('./ns.object.js'); | ||
| require('./ns.router.js'); | ||
| require('./ns.layout.js'); | ||
| require('./ns.model.js'); | ||
| require('./ns.modelCollection.js'); | ||
| require('./ns.box.js'); | ||
| require('./ns.view.js'); | ||
| require('./ns.viewCollection.js'); | ||
| require('./ns.page.js'); | ||
| require('./ns.request.js'); | ||
| require('./ns.update.js'); | ||
|
|
||
| module.exports = ns; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| var ns = ns || require('./ns.js'); | ||
|
|
||
| /** | ||
| * Хеш событий для удобного биндинга touch/desktop | ||
| * @type {object} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| var ns = ns || require('./ns.js'); | ||
|
|
||
| /** | ||
| * Типы узлов ns.layout | ||
| * @enum {string} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| var ns = ns || require('./ns.js'); | ||
|
|
||
| /** | ||
| * Replaces oldNode with newNode | ||
| * @param {Element} oldNode | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| var no = no || require('nommon'); | ||
| var ns = ns || require('./ns.js'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Может начать собирать Noscript через Browserify? Тогда каждый файл будет отдельным CommonJS модулем и, как следствие, (1) не придется оборачивать каждый файл в IIFE, (2) не придется помнить, что в выражении
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А напиши пример, пожалуйста. var ns = ns || require('ns');
ns.coolMethod = function() {
return 'cool';
};
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Вообще, в случае вспомогательной функции или класса, можно не прикреплять его к неймспейсу в самом модуле (чтобы без побочных эффектов): // cool-method.js
var COOL = 'cool';
module.exports = function coolMethod() {
return COOL;
};
// ns.js
var ns = {};
ns.coolMethod = require('./cool-method');
module.exports = ns;Но если без сильных изменений, то можно записать так: var ns = require('./ns');
module.exports = ns.coolMethod = function() {
return 'cool';
};
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Хм хм хм )
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Я за.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. да, browserify решает эту проблему Еще вот такая запись
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ну не надо это делать внутри замыкания просто
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Мы сами оборачиваем эти файлы в модули и такие строки все сломают |
||
|
|
||
| (function() { | ||
|
|
||
| /** | ||
|
|
@@ -189,5 +192,4 @@ | |
| } | ||
| return key; | ||
| } | ||
|
|
||
| })(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| var no = no || require('nommon'); | ||
| var ns = ns || require('./ns.js'); | ||
|
|
||
| (function() { | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| var no = no || require('nommon'); | ||
| var ns = ns || require('./ns.js'); | ||
|
|
||
| (function() { | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| var ns = ns || require('./ns.js'); | ||
|
|
||
| /** | ||
| * Хелперы для работы с объектами | ||
| * @namespace | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| var no = no || require('nommon'); | ||
| var ns = ns || require('./ns.js'); | ||
|
|
||
| (function() { | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| var no = no || require('nommon'); | ||
| var ns = ns || require('./ns.js'); | ||
|
|
||
| /** | ||
| * Find best page for url. | ||
| * @namespace | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
откуда в ns завязка на descript? А если я не хочу descript, а хочу express ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no.deнадо читать какnode, а не какno.descript.Это свойство из nommon.
Зависимости от descript - нет )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no.de - так не правильно определять что мы находимся в nodejs.
Если вы будете использовать browserify, то сразу наткнетесь на ошибку.
Лучше использовать такую прверку
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А ещё лучше - вообще не использовать проверки и писать код, не зависящий от окружения.
Вот не знаю, утопия это в наших обстоятельствах, или нет
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maksimr при желании, и эта проверка не будет работать, если в браузере нужный json-чик забацать )
Но и window можно и в nodejs объявить )
В общем - мы все умрём )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edoroshenko +1
@chestozo Я написал потому, что столкнулся с проблемами при созаднии yate-playground :)