Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions touch.blocks/ua/__dom/ua__dom.deps.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
({
mustDeps : 'ua',
shouldDeps : { block : 'i-bem', elem : 'dom' }
mustDeps : ['ua', 'i-bem-dom']
})
2 changes: 1 addition & 1 deletion touch.blocks/ua/__dom/ua__dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @module ua
* @description Use ua module to provide user agent features by modifiers and update some on orient change
*/
modules.define('ua', ['i-bem__dom'], function(provide, bemDom, ua) {
modules.define('ua', ['i-bem-dom'], function(provide, bemDom, ua) {

provide(/** @exports */bemDom.declBlock(this.name,
{
Expand Down
21 changes: 10 additions & 11 deletions touch.blocks/ua/__dom/ua__dom.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
Это позволяет учитывать особенности мобильного устройства, проверяя наличие и значение модификаторов.

```js
modules.define('ios-test', ['i-bem__dom'], function(provide, BEMDOM) {
modules.define('ios-test', ['i-bem-dom', 'ua'], function(provide, bemDom, Ua) {

provide(BEMDOM.decl(this.name, {
provide(bemDom.declBlock(this.name, {
onSetMod: {
js: {
inited: function() {
this.findBlockOutside('ua').hasMod('platform', 'ios') &&
this.findParentBlock(Ua).hasMod('platform', 'ios') &&
this.setMod('ios');
}
},
Expand Down Expand Up @@ -126,20 +126,19 @@ provide(BEMDOM.decl(this.name, {
Значение модификатора изменяется динамически при смене ориентации устройства. Поэтому можно подписываться на изменение значения модификатора:

```js
modules.define('inner', ['i-bem__dom'], function(provide, BEMDOM) {
modules.define('inner', ['i-bem-dom', 'ua'], function(provide, bemDom, Ua) {

provide(BEMDOM.decl(this.name, {
provide(bemDom.declBlock(this.name, {
onSetMod: {
js: {
inited: function() {
this._ua = this
.findBlockOutside('ua')
this._ua = this.findParentBlock(Ua);

this
._events(this.ua)
.on({ modName : 'orient', modVal : '*' }, this._onOrientChange, this);

this.setMod('orient', this._ua.getMod('orient'));
},
'': function() {
this._ua.un({ modName : 'orient', modVal : '*' }, this._onOrientChange, this);
}
},

Expand All @@ -161,7 +160,7 @@ provide(BEMDOM.decl(this.name, {
_reDraw: function(orient) {
// обновляем содержимое контейнера `inner` при смене ориентации устройства
console.log(orient);
BEMDOM.update(this.domElem, orient);
bemDom.update(this.domElem, orient);
}
}));

Expand Down
3 changes: 3 additions & 0 deletions touch.blocks/ua/ua.deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
({
shouldDeps : 'jquery'
})