This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { UserFile } from "../../../../server/UserFile"; | |
| const request = require("request"); | |
| const fs = require("fs"); | |
| export interface CDNResponse { | |
| name: string; | |
| folder: string; | |
| publicPath: string; å | |
| } | |
| export class Uploader { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { src, context, task } = require("fuse-box/sparky"); | |
| context(class { | |
| getConfig(){ | |
| return FuseBox.init({ | |
| homeDir : "src", | |
| output : "dist/$name.js", | |
| hash : this.production | |
| }); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { checkPassword } from "fuse-ts-raw-package" | |
| // that package contains "import" statement which | |
| // is nicely handled (split) by FuseBox | |
| async function testMe(){ | |
| const result = await checkPassword("123456"); | |
| console.log(result); | |
| } | |
| testMe(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function componentDecorator() { | |
| return function(target, key: string, descriptor: PropertyDescriptor) { | |
| let fileName = Reflect.getMetadata(“fusebox: __filename”, target, key); | |
| let dirName = Reflect.getMetadata(“fusebox: __dirname”, target, key); | |
| let requireDeatils = Reflect.getMetadata(“fusebox: require”, target, key); // Local “require” function | |
| let moduleDetails = Reflect.getMetadata(“fusebox: module”, target, key); | |
| let exportsCollection = Reflect.getMetadata(“fusebox: exports”, target, key); | |
| //load CSS by convention | |
| let cssFileName = fileName.replace(`.js`, `.css`); | |
| require(cssFileName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let auth = (user, pwd) => { | |
| return new Promise((resolve, reject) => { | |
| if( user !== "foo" && pwd !== "bar"){ | |
| return reject({ message : "Wrond credential"}) | |
| } | |
| return resolve({ | |
| user : user | |
| }); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const wait1 = (fn) => { | |
| return new Promise(resolve => setTimeout(resolve, 100)) | |
| } | |
| const wait2 = (fn) => { | |
| return new Promise(resolve => setTimeout(resolve, 200)) | |
| } | |
| const wait3 = (fn) => { | |
| return new Promise(resolve => setTimeout(resolve, 300)) | |
| } | |
| wait1() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db_.collection('service').remove({}, { | |
| w: 1 | |
| }, function(e) { | |
| should.not.exists(e); | |
| db_.collection('a').remove({}, { | |
| w: 1 | |
| }, function(e) { | |
| should.not.exists(e); | |
| db_.collection('b').remove({}, { | |
| w: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const wait1 = (fn) => { | |
| setTimeout(() => { | |
| fn() | |
| }, 100) | |
| } | |
| const wait2 = (fn) => { | |
| setTimeout(() => { | |
| fn() | |
| }, 200) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyChain { | |
| setFoo() { | |
| // I am the first one. And i set this.foo = "foo1" | |
| return "foo1"; | |
| } | |
| setBar() { | |
| // I am the second one, and i have "this.foo" at my disposal | |
| // And i set this.bar = "bar1" | |
| return "bar1"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const UserFlow = { | |
| fetchUser : (criteria) => { | |
| return User.find(criteria).first() // Fetching a record | |
| }, | |
| checkUserExists : (email) => { | |
| return this.fetchUser({email : email}); | |
| } | |
| } |