本文整理汇总了TypeScript中mobx.configure函数的典型用法代码示例。如果您正苦于以下问题:TypeScript configure函数的具体用法?TypeScript configure怎么用?TypeScript configure使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了configure函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: configure
import { store } from './store'
import { configure } from 'mobx'
import { regras } from './dbRegras'
import { pragas } from './dbPragas'
import { hospedeiros } from './dbHospedeiros'
import './utils'
import * as d3 from 'd3-array'
import 'jest'
configure({ enforceActions: 'observed' }) //useStrict(true)
const estadosSemAC = [
{ estado: '', UF: '' },
//{estado: 'Acre', UF: 'AC'},
{ estado: 'Alagoas', UF: 'AL' },
{ estado: 'Amazonas', UF: 'AM' },
{ estado: 'Amapá', UF: 'AP' },
{ estado: 'Bahia', UF: 'BA' },
{ estado: 'Ceará', UF: 'CE' },
{ estado: 'Distrito Federal', UF: 'DF' },
{ estado: 'Espirito Santo', UF: 'ES' },
{ estado: 'Goiás', UF: 'GO' },
{ estado: 'Maranhão', UF: 'MA' },
{ estado: 'Minas Gerais', UF: 'MG' },
{ estado: 'Mato Grosso do Sul', UF: 'MS' },
{ estado: 'Mato Grosso', UF: 'MT' },
{ estado: 'Pará', UF: 'PA' },
{ estado: 'Paraíba', UF: 'PB' },
{ estado: 'Pernambuco', UF: 'PE' },
{ estado: 'Piauí', UF: 'PI' },
示例2: configure
import { DateValue, format_date } from '../src/model';
import { configure, action } from 'mobx';
configure({
enforceActions: 'always'
});
it('date-value round to full day constructor', () => {
const n = new DateValue(new Date('2018-09-04 17:01:02'), 'what');
expect(n.date.get()).toEqual(new Date('2018-09-04'));
expect(n.formatDate.get()).toEqual(format_date(new Date('2018-09-04')));
});
it('date-value round to full day date', () => {
const n = new DateValue(new Date('2018-07-04 17:01:02'), 'what');
action(() => n.date.set(new Date('2018-09-04 17:01:02')))();
expect(n.date.get()).toEqual(new Date('2018-09-04'));
expect(n.formatDate.get()).toEqual(format_date(new Date('2018-09-04')));
});
it('date-value round to full day format_date', () => {
const n = new DateValue(new Date('2018-07-04 17:01:02'), 'what');
action(() => n.formatDate.set('2018-09-04'))();
expect(n.date.get()).toEqual(new Date('2018-09-04'));
expect(n.formatDate.get()).toEqual(format_date(new Date('2018-09-04')));
});
it('date-value round to full day fill', () => {
const n = new DateValue(new Date('2018-09-04 17:01:02'), 'what');
expect(n.toObj()).toEqual({
formatDate: '2018-09-04',
示例3: require
require("app-module-path").addPath(__dirname + "/..");
import { app, BrowserWindow } from "electron";
import { configure } from "mobx";
import { setup } from "setup/setup";
import * as HomeWindowModule from "main/home-window";
import * as SettingsModule from "main/settings";
import { openFile } from "main/project-editor-window";
configure({ enforceActions: "observed" });
////////////////////////////////////////////////////////////////////////////////
let setupFinished: boolean = false;
let projectFilePath: string | undefined;
app.on("ready", async function() {
// make sure there is only one instance of this application
// var gotTheLock = app.requestSingleInstanceLock();
// if (!gotTheLock) {
// app.quit();
// return;
// }
app.on("second-instance", function(event, commandLine, workingDirectory) {
const projectFilePath = commandLine[commandLine.length - 1];
if (projectFilePath.toLowerCase().endsWith(".eez-project")) {
openFile(projectFilePath);
} else {
const {
示例4: useStrict
export default function useStrict(strictMode: boolean) {
configure({ enforceActions: strictMode ? 'observed' : 'never' });
}
示例5: configure
import { configure } from 'mobx';
import DashBoardStore from './routes/dashboard/dashboard.store';
import LoginStore from './routes/login/login.store';
import UserStore from './routes/user/user.store';
import PostStore from './routes/post/post.store';
import SharedStore from './shared.store';
import CategoryStore from './routes/category/category.store';
import PushStore from './routes/push/push.store';
import PageStore from './routes/page/page.store';
import ArticleStore from './components/article/article.store';
import AppearanceStore from './routes/appearance/appearance.store';
import OptionsStore from './routes/options/options.store';
configure({
enforceActions: 'never'
});
export class AppStore {
dashBoardStore: DashBoardStore;
loginStore: LoginStore;
userStore: UserStore;
postStore: PostStore;
categoryStore: CategoryStore;
sharedStore: SharedStore;
pushStore: PushStore;
pageStore: PageStore;
articleStore: ArticleStore;
constructor() {
this.sharedStore = new SharedStore();
示例6: configure
import { configure } from 'mobx';
import Store from './Stores/Store';
import ChromeExtensionStorage from './StorageProviders/ChromeExtensionStorage';
import { parse } from 'url';
import { action } from 'mobx/lib/api/action';
configure({
enforceActions: true
});
const manifest = chrome.runtime.getManifest();
const clipboardholder: HTMLInputElement = document.getElementById('clipboard') as HTMLInputElement;
chrome.runtime.onInstalled.addListener(function (details) {
if (details.reason == "install") {
chrome.tabs.create({
url: "settings.html"
});
}
if (details.reason == "update") {
var notificationOptions = {
type: 'basic',
title: manifest.name,
message: manifest.name + ' been updated to version: "' + manifest.version + '".',
iconUrl: "icons/icon48.png",
isClickable: false
}
chrome.notifications.create(null, notificationOptions);
}
});