小编Sha*_*oon的帖子

Google文档如何自动保存?

好的,我知道这听起来很通用.但我的意思是在AJAX级别上.我曾尝试使用Firebug跟踪NET连接和帖子,这是一个谜.有没有人知道如何在不破坏网络/浏览器的情况下不断进行即时自动保存?

ajax google-docs

8
推荐指数
1
解决办法
4761
查看次数

我可以在项目中混合使用JS和CoffeeScript吗?

我正在使用ExpressJS,而且app.js是直接的JavaScript.如果我想使用CoffeeScript,我是否必须重写app.js或者我可以用其他文件编写CoffeeScript吗?

node.js coffeescript express

8
推荐指数
2
解决办法
2379
查看次数

有没有括号在CoffeeScript中编写点属性的方法?

Server = require('mongodb').Server
Run Code Online (Sandbox Code Playgroud)

那是我CoffeeScript现在的.有()什么方法可以放弃那些?

coffeescript

8
推荐指数
2
解决办法
385
查看次数

如何检测以编程方式生成的UIView的旋转

我有一个UIView以编程方式创建的:

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
    if (self) {
        self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.5];

        UIImageView* closeButton = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"modal_close.png"]];

        closeButton.frame = CGRectMake(self.frame.size.width*.89, self.frame.size.height*.09, closeButton.frame.size.width, closeButton.frame.size.height);

        UIButton* button = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width*.89, self.frame.size.height*.09,20, 20)];

        [button addTarget:self action:@selector(close) forControlEvents:UIControlEventTouchUpInside];

        UIView* mainView = [[UIView alloc] initWithFrame:CGRectMake(self.frame.size.width*.1,self.frame.size.height*.1,self.frame.size.width*.8,self.frame.size.height*.8)];

        mainView.backgroundColor = [UIColor whiteColor];
        _displayMainView = mainView;        

        [self addSubview:_displayMainView];
        [self addSubview:closeButton];
        [self addSubview:button];

        mainView = nil;
        closeButton = nil;
    }
    return self;
}
Run Code Online (Sandbox Code Playgroud)

如何检测旋转?这是作为另一个现有视图之上的模态.这是一款仅限iPad的应用,如果重要的话.

objective-c rotation uiview ios

8
推荐指数
3
解决办法
2万
查看次数

如何使用PassportJS保护API端点?

我的应用程序使用Express和AngularJS.我正在使用express通过静态来处理角度代码的基本网络搜索.角度代码使用命中由express托管的API端点的服务.我只希望在用户通过身份验证后可以访问API端点.我怎样才能通过PassportJS实现这一目标?

express angularjs passport.js

8
推荐指数
1
解决办法
7067
查看次数

获取错误:等待Protractor与页面同步时出错:{}

我的e2e.conf.coffee档案是:

exports.config =
  baseUrl: 'http://localhost:9001'
  specs: [
    'e2e/**/*.coffee'
  ]

  framework: 'jasmine'
Run Code Online (Sandbox Code Playgroud)

我让我的节点项目运行并在端口9001上侦听.

我的测试是:

describe 'Happy Path', ->
  it 'should show the login page', ->
    console.log browser

    expect(browser.getLocationAbsUrl()).toMatch("/view1");
  it 'should fail to login', ->
    setTimeout ->
      console.log "FAIL!"
    , 1200
Run Code Online (Sandbox Code Playgroud)

而我得到的错误是:

Failures:

  1) Happy Path should show the login page
   Message:
     Error: Error while waiting for Protractor to sync with the page: {}
   Stacktrace:
     Error: Error while waiting for Protractor to sync with the page: {}
    at <anonymous>
    at …
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-e2e protractor

8
推荐指数
2
解决办法
2万
查看次数

如何在AngularJS中测试.run?

myApp.run([
  '$rootScope', 'userService', function($rootScope, userService) {
    return userService.isAuthenticated().then(function(response) {
      if (response.data.authenticated) {
        return $rootScope.$broadcast('login', response.data);
      } else {
        return userService.logout();
      }
    });
  }
]);
Run Code Online (Sandbox Code Playgroud)

那是我在init.js文件中的代码.我怎样才能对此进行单元测试?

angularjs karma-runner

8
推荐指数
1
解决办法
3445
查看次数

预期的字符串文字。在打字稿中导入时

import * as app from `${process.cwd()}/server`
Run Code Online (Sandbox Code Playgroud)

它给了我错误:

[ts] String literal expected.
Run Code Online (Sandbox Code Playgroud)

导入时不能插入字符串吗?

typescript

8
推荐指数
1
解决办法
8789
查看次数

如何使用 next.js 指定子样式?

我有:

import styles from './Editor.module.css'
...
      <ReactQuill
        theme="bubble"
        value={documentState.content}
        onChange={handleChange}
        modules={modules}
        formats={formats}
        onKeyDown={handleKeyDown}
        className={styles.quill}
      />
Run Code Online (Sandbox Code Playgroud)

哪里Editor.module.css

.quill {
  height: 100%;
  flex-grow: 1;
  padding: 0;
  position: relative;
}

.quill  .ql-container {
  position: absolute !important;
}

Run Code Online (Sandbox Code Playgroud)

所以.quill风格得到了正确的应用。但子元素.ql-container却没有。

在此输入图像描述

我究竟做错了什么?

javascript css next.js

8
推荐指数
1
解决办法
4061
查看次数

类型“() =&gt; () =&gt; Promise&lt;void&gt;”的参数不可分配给“EffectCallback”类型的参数

我的代码是:

    useEffect(() => {
        document.querySelector('body').style['background-color'] = 'rgba(173, 232, 244,0.2)';
        window.$crisp.push(['do', 'chat:hide']);

        return async () => {
            window.$crisp.push(['do', 'chat:show']);
            document.querySelector('body').style['background-color'] = '#ffffff';
            if (router.query.id) {
                const resDoc = await firebase.firestore().doc(`documents/${router.query.id}`).get();
                if (resDoc.exists) {
                    await clearDocPrediction(router.query.id);
                }
            }
        };
    }, []);
Run Code Online (Sandbox Code Playgroud)

现在我返回的原因是因为我相信它在卸载时执行函数清理,所以我需要保留它。这是某种构建错误,我不太确定如何解决。任何帮助将不胜感激。

typescript reactjs next.js

8
推荐指数
1
解决办法
1万
查看次数