當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript delegateTo.delegateTo函數代碼示例

本文整理匯總了TypeScript中app/utils/delegateTo.delegateTo函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript delegateTo函數的具體用法?TypeScript delegateTo怎麽用?TypeScript delegateTo使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了delegateTo函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: DateFieldInput

export function DateFieldInput(value) {
  var input = new TextFieldInput(value);
  var datePickerButton = createDatePickerButton(this);

  this.getValue = delegateTo(input, 'getValue');
  this.setValue = delegateTo(input, 'setValue');
  this.focus = delegateTo(input, 'focus');
  this.addDatePicker = delegateTo(input, 'precedeWith');
  this.setStyle = delegateTo(input, 'setStyle');

  this.appendTo = function(parentDomElement) {
    input.appendTo(parentDomElement);
    parentDomElement.appendChild(datePickerButton);
  };

  this.getDate = function() {
    var text = input.getValue();
    return text ? DateFormatting.parse(text, DateFieldInput.DATE_FORMAT) : new Date();
  };

  this.setDate = function(date) {
    var formattedDate = DateFormatting.format(date, DateFieldInput.DATE_FORMAT);
    input.setValue(formattedDate);
  };
}
開發者ID:gurdiga,項目名稱:xo,代碼行數:25,代碼來源:DateFieldInput.ts

示例2: Section

export function Section(labelText) {
  var container = createContainer(labelText);

  this.appendTo = delegateTo(container, 'appendTo');
  this.setStyle = delegateTo(container, 'setStyle');
  this.appendWidgets = delegateTo(container, 'appendWidgets');
}
開發者ID:gurdiga,項目名稱:xo,代碼行數:7,代碼來源:Section.ts

示例3: DateField

export function DateField(defaultValue) {
  var domElement = createDOMElement('date-field');
  WidgetRole.apply(this, [domElement]);

  var dateFieldInput = new DateFieldInput(defaultValue);
  dateFieldInput.appendTo(domElement);

  this.getValue = delegateTo(dateFieldInput, 'getValue');
  this.focus = delegateTo(dateFieldInput, 'focus');
  this.setStyle = delegateTo(dateFieldInput, 'setStyle');
}
開發者ID:gurdiga,項目名稱:xo,代碼行數:11,代碼來源:DateField.ts

示例4: LabeledLargeTextField

export function LabeledLargeTextField(labelText, value) {
  var domElement = createElement();
  WidgetRole.apply(this, [domElement]);

  var textarea = createTextareaElement(value);
  var label = new FieldLabel(labelText, [textarea]);
  label.appendTo(domElement);

  this.focus = delegateTo(textarea, 'focus');
  this.getValue = delegateTo(textarea, 'value');
}
開發者ID:gurdiga,項目名稱:xo,代碼行數:11,代碼來源:LabeledLargeTextField.ts

示例5: before

    before(function() {
      date = new Date();
      date.format = 'YY-MM-DD';
      date.falsyProperty = '';

      dateWrapper = {
        toString: delegateTo(date, 'toString'),
        getFormat: delegateTo(date, 'format'),
        getFalsyProperty: delegateTo(date, 'falsyProperty')
      };
    });
開發者ID:gurdiga,項目名稱:xo,代碼行數:11,代碼來源:delegateToTest.ts

示例6: LabeledTextField

export function LabeledTextField(labelText, value) {
  var domElement = createElement();
  WidgetRole.apply(this, [domElement]);

  var input = new TextFieldInput(value);
  addLabel(domElement, labelText, input);

  this.getValue = delegateTo(input, 'getValue');

  this.focus = delegateTo(input, 'focus');
}
開發者ID:gurdiga,項目名稱:xo,代碼行數:11,代碼來源:LabeledTextField.ts

示例7: LabeledDateField

export function LabeledDateField(labelText, value) {
  var domElement = createElement();
  WidgetRole.apply(this, [domElement]);

  var input = new DateField(value);
  var label = new FieldLabel(labelText, [input]);
  label.appendTo(domElement);

  this.getValue = delegateTo(input, 'getValue');
  this.focus = delegateTo(input, 'focus');
  this.setStyle = delegateTo(input, 'setStyle');
}
開發者ID:gurdiga,項目名稱:xo,代碼行數:12,代碼來源:LabeledDateField.ts

示例8: InstitutionActivity

export function InstitutionActivity() {
  var descriptionText = 'Intentarea';
  var activity = new Activity('InstitutionActivity', descriptionText);
  var todoList = new TodoList();

  activity.setDetailWidgets([todoList]);

  this.getDescription = delegateTo(activity, 'getDescription');
  this.appendTo = delegateTo(activity, 'appendTo');
  this.setDetailWidgets = delegateTo(activity, 'setDetailWidgets');

  this.setData = function(data) {
    todoList.setData(data['todo-items']);
  };
}
開發者ID:gurdiga,項目名稱:xo,代碼行數:15,代碼來源:InstitutionActivity.ts

示例9: RefusalActivity

export function RefusalActivity() {
  var descriptionText = 'Refuz';
  var activity = new Activity('RefusalActivity', descriptionText);

  activity.setDetailWidgets([
    document.createTextNode('RefusalActivity TODO')
  ]);

  this.getDescription = delegateTo(activity, 'getDescription');
  this.appendTo = delegateTo(activity, 'appendTo');

  this.setData = function() {
     // TODO
  };
}
開發者ID:gurdiga,項目名稱:xo,代碼行數:15,代碼來源:RefusalActivity.ts

示例10: TextFieldInput

export function TextFieldInput(value) {
  var domElement = createElement(value);
  WidgetRole.apply(this, [domElement]);

  this.getValue = delegateTo(domElement, 'value');

  this.setValue = function(value) {
    domElement.value = value;
  };

  this.focus = delegateTo(domElement, 'focus');

  this.precedeWith = function(elementToInsert) {
    domElement.parentNode.insertBefore(elementToInsert, domElement);
  };
}
開發者ID:gurdiga,項目名稱:xo,代碼行數:16,代碼來源:TextFieldInput.ts


注:本文中的app/utils/delegateTo.delegateTo函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。