当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript WallTime.init方法代码示例

本文整理汇总了TypeScript中chronoshift.WallTime.init方法的典型用法代码示例。如果您正苦于以下问题:TypeScript WallTime.init方法的具体用法?TypeScript WallTime.init怎么用?TypeScript WallTime.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chronoshift.WallTime的用法示例。


在下文中一共展示了WallTime.init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: require

  ], (require) => {
    var WallTime = require('chronoshift').WallTime;
    var queryUrlExecutorFactory = require('./utils/ajax/ajax').queryUrlExecutorFactory;
    var AppSettings = require('../common/models/index').AppSettings;
    var PivotApplication = require('./views/pivot-application/pivot-application').PivotApplication;

    var appSettings = AppSettings.fromJS(config.appSettings).attachExecutors((dataSource: DataSource) => {
      return queryUrlExecutorFactory(dataSource.name, 'plywood', version);
    });

    // Init chronoshift
    if (!WallTime.rules) {
      var tzData = require('chronoshift/lib/walltime/walltime-data.js');
      WallTime.init(tzData.rules, tzData.zones);
    }

    ReactDOM.render(
      React.createElement(
        PivotApplication,
        {
          version,
          user: config.user,
          appSettings,
          readOnly: config.readOnly
        }
      ),
      container
    );
  }, 'pivot-main');
开发者ID:boneill42,项目名称:pivot,代码行数:29,代码来源:pivot-entry.ts

示例2: require

  ], (require) => {
    var List = require('immutable').List;
    var WallTime = require('chronoshift').WallTime;
    var queryUrlExecutorFactory = require('./utils/ajax/ajax').queryUrlExecutorFactory;
    var DataSource = require('../common/models/index').DataSource;
    var PivotApplication = require('./components/pivot-application/pivot-application').PivotApplication;

    // Init chronoshift
    if (!WallTime.rules) {
      var tzData = require('chronoshift/lib/walltime/walltime-data.js');
      WallTime.init(tzData.rules, tzData.zones);
    }

    var dataSources = List(config.dataSources.map((dataSourceJS: DataSourceJS) => {
      var executor = queryUrlExecutorFactory(dataSourceJS.name, '/plywood', version);
      return DataSource.fromJS(dataSourceJS, { executor });
    }));

    ReactDOM.render(
      React.createElement(
        PivotApplication,
        {
          version,
          user: config.user,
          dataSources,
          linkViewConfig: config.linkViewConfig
        }
      ),
      container
    );
  }, 'pivot-main');
开发者ID:aakki,项目名称:pivot,代码行数:31,代码来源:pivot-entry.ts

示例3: require

  ], (require) => {
    const WallTime = require('chronoshift').WallTime;
    const queryUrlExecutorFactory = require('./utils/ajax/ajax').queryUrlExecutorFactory;
    const AppSettings = require('../common/models/index').AppSettings;
    const MANIFESTS = require('../common/manifests/index').MANIFESTS;
    const PivotApplication = require('./views/pivot-application/pivot-application').PivotApplication;

    var appSettings = AppSettings.fromJS(config.appSettings, {
      visualizations: MANIFESTS,
      executorFactory: (dataCube: DataCube) => {
        return queryUrlExecutorFactory(dataCube.name, 'plywood', version);
      }
    });

    // Init chronoshift
    if (!WallTime.rules) {
      var tzData = require('chronoshift/lib/walltime/walltime-data.js');
      WallTime.init(tzData.rules, tzData.zones);
    }

    ReactDOM.render(
      React.createElement(
        PivotApplication,
        {
          version,
          user: config.user,
          appSettings
        }
      ),
      container
    );
  }, 'pivot-main');
开发者ID:djfwan,项目名称:pivot,代码行数:32,代码来源:pivot-entry.ts

示例4: require

import { expect } from 'chai';
import { Timezone, Duration, day, month } from 'chronoshift';
import { TimeRange } from 'plywood';
import { datesEqual, prependDays, appendDays, getEndWallTimeInclusive, getWallTimeDay, getWallTimeMonthWithYear, formatTimeBasedOnGranularity, formatTimeRange } from './time';

var { WallTime } = require('chronoshift');
if (!WallTime.rules) {
  var tzData = require("chronoshift/lib/walltime/walltime-data.js");
  WallTime.init(tzData.rules, tzData.zones);
}

describe('Time', () => {
  it('calculates date equality properly', () => {
    expect(datesEqual(null, new Date()), 'null and not null').to.equal(false);
    expect(datesEqual(null, null), 'null and null').to.equal(true);
    expect(datesEqual(new Date('1995-02-24T00:00:00.000Z'), new Date('1995-02-24T00:00:00.000Z')), 'equal dates').to.equal(true);
    expect(datesEqual(new Date('1995-02-24T00:00:00.000Z'), new Date('1995-02-24T00:02:00.000Z')), 'not equal dates').to.equal(false);
  });

  it('prepends days', () => {
    var testFirstWeek: Date[] = [];
    for (var i = 1; i < 5; i++) {
      testFirstWeek.push(new Date(Date.UTC(1995, 2, i)));
    }

    var prepended = prependDays(Timezone.UTC, testFirstWeek, 5);
    expect(prepended).to.deep.equal([
      new Date('1995-02-24T00:00:00.000Z'),
      new Date('1995-02-25T00:00:00.000Z'),
      new Date('1995-02-26T00:00:00.000Z'),
      new Date('1995-02-27T00:00:00.000Z'),
开发者ID:WuQic,项目名称:pivot,代码行数:31,代码来源:time.mocha.ts


注:本文中的chronoshift.WallTime.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。