本文整理汇总了TypeScript中webfontloader.load函数的典型用法代码示例。如果您正苦于以下问题:TypeScript load函数的具体用法?TypeScript load怎么用?TypeScript load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: Promise
return new Promise(function(resolve, reject) {
load({
google: {
families: ['Lato', 'Montserrat']
},
active: resolve,
inactive: reject
})
})
开发者ID:MikaAK,项目名称:trello-burndown,代码行数:9,代码来源:index.ts
示例2:
window.onload = () => {
WebFont.load({
google: {
families: [fontFamily]
},
active: init,
inactive: init,
timeout: 2000
});
};
开发者ID:abagames,项目名称:pixel-art-gen,代码行数:10,代码来源:recoil.ts
示例3: main
export function main() {
// Load fonts async
// https://github.com/typekit/webfontloader#configuration
loadWebFont({
google: {
families: ['Droid Sans']
}
});
return platformRef.bootstrapModuleFactory(MainModuleNgFactory);
}
开发者ID:Hongbo-Miao,项目名称:universal-starter,代码行数:11,代码来源:client.aot.ts
示例4: loadThemeFonts
export function loadThemeFonts() {
const state = getDeferredStoreState<ICoreStoreState, null>(null);
if (state !== null) {
const assets = state.theme.assets.data || {};
const { fonts } = assets;
if (fonts) {
const webFontConfig: WebFont.Config = {
custom: {
families: fonts.map(font => font.name),
urls: fonts.map(font => font.url),
},
};
if (webFontConfig.custom && webFontConfig.custom.urls && webFontConfig.custom.urls.length > 0) {
WebFont.load(webFontConfig);
}
} else {
// If the theme has no font config of its own, load the default.
WebFont.load(defaultFontConfig);
}
}
}
开发者ID:vanilla,项目名称:vanilla,代码行数:23,代码来源:loadThemeFonts.ts
示例5: preload
preload () {
WebFont.load({
google: {
families: ['Nunito']
},
active: this.fontsLoaded
})
let text = this.add.text(this.world.centerX, this.world.centerY, 'loading fonts', { font: '16px Arial', fill: '#dddddd', align: 'center' })
text.anchor.setTo(0.5, 0.5)
this.load.image('loaderBg', './assets/images/loader-bg.png')
this.load.image('loaderBar', './assets/images/loader-bar.png')
}
开发者ID:mgiambalvo,项目名称:phaser-typescript-webpack-starter,代码行数:14,代码来源:boot.ts
示例6: start
function start() {
WebFont.load({
custom: {
families: ['moonhouseregular'],
urls: ['assets/fonts.css']
}
});
(document.querySelector(".overlay") as any).style.display = "none";
let game = new Phaser.Game(800, 600, Phaser.AUTO);
game.state.add("boot", Boot);
game.state.add("loader", Loader);
game.state.add("game", Phase1);
game.state.start("boot");
}
开发者ID:monagames,项目名称:spacemonas,代码行数:15,代码来源:main.ts
示例7: startApp
window.onload = () => {
let webFontLoaderOptions: any = null;
let webFontsToLoad: string[] = GOOGLE_WEB_FONTS;
if (webFontsToLoad.length > 0) {
webFontLoaderOptions = (webFontLoaderOptions || {});
webFontLoaderOptions.google = {
families: webFontsToLoad
};
}
if (Object.keys(Assets.CustomWebFonts).length > 0) {
webFontLoaderOptions = (webFontLoaderOptions || {});
webFontLoaderOptions.custom = {
families: [],
urls: []
};
for (let font in Assets.CustomWebFonts) {
webFontLoaderOptions.custom.families.push(Assets.CustomWebFonts[font].getFamily());
webFontLoaderOptions.custom.urls.push(Assets.CustomWebFonts[font].getCSS());
}
}
if (webFontLoaderOptions === null) {
// Just start the game, we don't need any additional fonts
startApp();
} else {
// Load the fonts defined in webFontsToLoad from Google Web Fonts, and/or any Local Fonts then start the game knowing the fonts are available
webFontLoaderOptions.active = startApp;
WebFontLoader.load(webFontLoaderOptions);
}
};
开发者ID:PLyn,项目名称:PhaserTypescriptStarterTemplate,代码行数:36,代码来源:app.ts
示例8: load
import * as path from "path";
import { load } from "webfontloader";
const fontFolder = ["..", "node_modules", "nteract-assets", "fonts"];
load({
custom: {
families: ["Source Sans Pro", "Source Code Pro"],
urls: [
path.join(...fontFolder, "source-sans-pro", "source-sans-pro.css"),
path.join(...fontFolder, "source-code-pro", "source-code-pro.css")
]
}
});
开发者ID:nteract,项目名称:nteract,代码行数:14,代码来源:fonts.ts
示例9: load
// TODO: There is the potential to have a Flash-of-Unstyled-Content since this is
// now async
import { load } from "webfontloader";
load({
google: {
families: ["Source Sans Pro", "Source Serif Pro", "Source Code Pro"]
}
});
开发者ID:nteract,项目名称:nteract,代码行数:9,代码来源:fonts.ts
示例10: require
import 'reflect-metadata';
import 'core-js/es6';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'ts-helpers';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { QtAppModule } from './app.module';
const WebFont = require('webfontloader');
WebFont.load({
google: {
families: [
'Roboto:400,500,700',
'Playfair+Display:400,700',
'Material+Icons',
],
},
});
if (__PRODUCTION__) {
enableProdMode();
} else {
require('zone.js/dist/long-stack-trace-zone');
}
platformBrowserDynamic().bootstrapModule(QtAppModule);
开发者ID:rtbm,项目名称:ng2-quottr,代码行数:29,代码来源:boot.ts
注:本文中的webfontloader.load函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论