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


TypeScript Editor.save方法代码示例

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


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

示例1: Error

     "that did nothing", (done) => {
       // tslint:disable-next-line:no-floating-promises
       editor.save().then(() => {
         // We're testing that autosave is not called again after the first
         // time.
         let autosaved = false;
         const interval = 50;
         const sub = editor.saver.events
           .pipe(filter((x) => x.name === "Autosaved"))
           .subscribe(() => {
             if (autosaved) {
               throw new Error("autosaved more than once");
             }
             autosaved = true;
             assert.deepEqual(server.lastSaveRequest, {
               command: "autosave",
               version: version,
               data: "<TEI xmlns=\"http://www.tei-c.org/ns/1.0\">\
<teiHeader><fileDesc><titleStmt><title>abcd</title></titleStmt>\
<publicationStmt/><sourceDesc><p/></sourceDesc>\
</fileDesc></teiHeader><text><body><p>Blah blah <term>blah</term> blah.</p>\
<p><term>blah</term></p></body></text></TEI>",
             });
             setTimeout(() => {
               sub.unsubscribe();
               done();
             }, interval * 2);
           });
         editor.saver.setAutosaveInterval(interval);
         setTimeout(() => {
           assert.isFalse(autosaved, "should not have been saved yet");
           editor.dataUpdater.removeNode(editor.dataRoot.querySelector("p"));
         }, interval * 2);
       });
     });
开发者ID:lddubeau,项目名称:wed,代码行数:35,代码来源:wed-save-test.ts

示例2: it

 it("does not autosave if not modified", (done) => {
   // tslint:disable-next-line:no-floating-promises
   editor.save().then(() => {
     const sub = editor.saver.events
       .pipe(filter((ev) => ev.name === "Autosaved")).subscribe(() => {
         throw new Error("autosaved!");
       });
     editor.saver.setAutosaveInterval(50);
     setTimeout(() => {
       sub.unsubscribe();
       done();
     }, 500);
   });
 });
开发者ID:lddubeau,项目名称:wed,代码行数:14,代码来源:wed-save-test.ts


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