小编Eli*_*ias的帖子

TypeScript + moment.js:错误TS2307:找不到模块'时刻'

我正在开发一个Web应用程序,使用angular 1.5,typescript 2.4.0,时刻:2.18.1,以及用于项目组装的gulp.

这是我的tsconfig.json:

{
  "files": [
    "src/app/main.ts",
    "types/**/*.ts"
  ],
  "compilerOptions": {
    "noImplicitAny": false,
    "target": "es2015",
    "allowSyntheticDefaultImports": true
  }
}
Run Code Online (Sandbox Code Playgroud)

我的内心date-range-picker.component.ts.我正在导入片段lib,正如主文档中提出的那样:

import * as moment from 'moment'; 
Run Code Online (Sandbox Code Playgroud)

哪个适用于依赖tsify插件的主要gulp项目组装任务:

var browserifyIt = browserify({
    basedir: '.',
    debug: true,
    entries: paths.browserifyEntries,
    cache: {},
    packageCache: {}
}).plugin(tsify);

gulp.task('bundle', ['views'], function () {
    return browserifyIt
        .transform('babelify', {
            presets: ['es2015'],
            extensions: ['.ts']
        })
        .bundle()
        .on('error', interceptErrors)
        .pipe(source(fileNames.buildJs))
        .pipe(ngAnnotate())
        .pipe(buffer())
        .pipe(sourcemaps.init({loadMaps: true}))
        .pipe(sourcemaps.write(paths.sourcemapPath))
        .pipe(gulp.dest(paths.build));
});
Run Code Online (Sandbox Code Playgroud)

但是为了编译测试,我决定使用tsProject()的任务:

const testSrcPaths = {
    ...., …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs momentjs typescript gulp

5
推荐指数
1
解决办法
4029
查看次数

Google Apps脚本,不能包含CSS

我是Google Apps脚本的新手。我已经尝试了一些示例,这些示例都可以正常工作,但是我坚持使用CSS文件。

在我的code.gs中,我创建了include函数:

function include(filename) {
   return HtmlService.createHtmlOutputFromFile(filename)
  .getContent();
}
Run Code Online (Sandbox Code Playgroud)

我还创建了css文件“ Sidebar.css.html”,其中包含一些样式参数:

<style>
.branding-below {
 bottom: 56px;
 top: 0;
}

.branding-text {
left: 7px;
position: relative;
top: 3px;
}

.col-contain {
overflow: hidden;
}

.col-one {
float: left;
width: 50%;
}

.logo {
vertical-align: middle;
}

.radio-spacer {
height: 20px;
}

.width-100 {
width: 100%;
}
</style>
Run Code Online (Sandbox Code Playgroud)

在我的Sidebar.html中,我尝试包含CSS:

<?!= include('Sidebar.css.html'); ?>
Run Code Online (Sandbox Code Playgroud)

这显然没有用。结果如下:

在此链接中您可以看到结果(抱歉,我没有足够的人来张贴它):http : //dl1.joxi.net/drive/0005/1191/378023/150727/371cdf01c0.jpg

我该怎么办?

html javascript css google-sheets google-apps-script

3
推荐指数
1
解决办法
1152
查看次数

使用 AudioBuffer 作为 HTMLAudioElement 的源?

如何将解码AudioBuffer数据设置为 的来源HTMLAudioElement

让我们假设我们有一个HTMLAudioElement

let audio = new Audio();
Run Code Online (Sandbox Code Playgroud)

我们还能够接收和解码音频数据:

let context = new AudioContext();
let source = context.createBufferSource(); //this represents the audio source. We need to now populate it with binary data.

Api.getAudioFile(url).then((data) => {
  context.decodeAudioData(data, (buffer) => {
    source.buffer = buffer;
  }, null);
});
Run Code Online (Sandbox Code Playgroud)

如何将其source用作audio? 我假设我必须为此创建一个MediaStream对象,但不太清楚如何去做。

javascript javascript-audio-api

2
推荐指数
1
解决办法
1521
查看次数